Skip to main content

Chat

Fetch all data related to ImBox Chat

listConversations

Lists all conversations within a given timespan.

Parameters

NameTypeDescription
apiKey*StringYour API Key
userId*StringYour userId
fromDate*StringFormat: YYYY-MM-DD
toDate*StringFormat: YYYY-MM-DD
pageFilterIdArray<String>Page filters

Usage

curl -X GET "https://apiv2.imbox.io/message/listConversations/apiKey/userId/fromDate/toDate?pageFilterId=1&pageFilterId=2"

Response

{
"result": "success",
"json": [
{
"sid": 1, // userId
"conversationID": "V1", // Channel / ConversationId
"date": "2020-01-01T00:00:00.000Z" // Created date
},
{
"sid": 1,
"conversationID": "V18751500044654323221",
"date": "2020-01-01T00:00:00.000Z"
}
],
"length": 2
}

grabConversation

Get a conversation by conversation id.

Parameters

NameTypeDescription
apiKey*StringYour API Key
userId*StringYour userId
conversationId*StringYou can get the conversationId from listConversations

Usage

curl -X GET "https://apiv2.imbox.io/message/grabConversation/apiKey/userId/conversationID"

Response

{
"result": "success",
"json": [
{
"id": 1, // messageId
"sid": 1,
"conversationID": "V1",
"from": "John", // Name of sender
"message": "Hello",
"date": "2020-01-01T00:00:00.000Z",
"agentID": 1 // agentId of sender, will be 0 if from Visitor and null if from system
},
{
"id": 2,
"sid": 1,
"conversationID": "V1",
"from": "John",
"message": "how can i help you today? :)",
"date": "2020-01-01T00:00:00.000Z",
"agentID": 1
},
{
"id": 702005,
"sid": 1,
"conversationID": "V1",
"from": "V1",
"message": "Hi, where can i find the documentation page?",
"date": "2020-01-01T00:00:00.000Z",
"agentID": 0
},
{
"id": 702004,
"sid": 1,
"conversationID": "V1",
"from": "system",
"message": "{\"type\":\"visitorJoin\",\"currentPage\":\"https://example.org/support\"}",
"date": "2020-01-01T00:00:00.000Z",
"agentID": null
}
],
"length": 4
}

grabVisitorInfo

Get information about a visitor.

Parameters

NameTypeDescription
apiKey*StringYour API Key
userId*StringYour userId
conversationId*StringYou can get the conversationId from listConversations

Usage

curl -X GET "https://apiv2.imbox.io/message/grabVisitorInfo/apiKey/userId/conversationID"

Response

{
"result": "success",
"json": [
{
"trafficType": "Direct", // Direct|Organic|www.referral-domain.com
"se_type": "", // If organic traffic: Google|Bing|Yahoo|etc
"sid": 1,
"conversationID": "V1",
"last_visit": "2020-01-01T00:00:00.000Z",
"browser": "Chrome 50.0.0",
"os": "Windows 7 0.0.0",
"user_city": "Stockholm",
"user_country": "Sweden",
"exitPage": "https://imbox.se/"
}
]
}

grabVisitorTags

Get the tags set on a visitor conversation.

Parameters

NameTypeDescription
apiKey*StringYour API Key
userId*StringYour userId
conversationId*StringYou can get the conversationId from listConversations

Usage

curl -X GET "https://apiv2.imbox.io/message/grabVisitorTags/apiKey/userId/conversationID"

Response

{
"result": "success",
"json": [
{
"sid": 1,
"conversationID": "V1",
"createdDate": "2020-01-01T00:00:00.000Z",
"tag": "John Doe",
"type": 0 // Type 0 is the visitors name, can be set in client or via changeName widget api.
},
{
"sid": 1,
"conversationID": "V1",
"createdDate": "2020-01-01T00:00:00.000Z",
"tag": "Custom tag",
"type": 1 // Regular tag set on visitor
}
],
"length": 2
}

grabVisitorLabels

Get labels set on a visitor conversation.

Parameters

NameTypeDescription
apiKey*StringYour API Key
userId*StringYour userId
conversationId*StringYou can get the conversationId from listConversations

Usage

curl -X GET "https://apiv2.imbox.io/message/grabVisitorLabels/apiKey/userId/conversationID"

Response

{
"result": "success",
"json": [
{
"conversationID": "V1",
"createdDate": "2020-01-01T00:00:00.000Z",
"label": "Support"
},
{
"conversationID": "V1",
"createdDate": "2020-00-00T00:00:00.000Z",
"label": "BankId Verified"
}
]
}

grabVisitorCards

Get data set by insertCard widget api.

Read more here: insertCard

Parameters

NameTypeDescription
apiKey*StringYour API Key
userId*StringYour userId
conversationId*StringYou can get the conversationId from listConversations

Usage

curl -X GET "https://apiv2.imbox.io/message/grabVisitorCards/apiKey/userId/conversationID"

Response

{
"result": "success",
"json": [
{
"dataID": "1", // Id inserted with insertCard
"data": "Name: John Doe", // Data inserted with insertCard
"sid": 1, // userId
"conversationID": "V1",
"createdDate": "2020-01-01T00:00:00.000Z",
"updatedDate": "2020-01-01T00:00:00.000Z"
}
]
}

grabAgent

Get an agent.

Parameters

NameTypeDescription
apiKey*StringYour API Key
userId*StringYour userId
agentId*StringAgentId

Usage

curl -X GET "https://apiv2.imbox.io/message/grabAgent/apiKey/userId/agentId"

Response

{
"result": "success",
"json": [
{
"agentID": 1,
"sid": 1, // userId
"agentName": "John",
"agentEmail": "john.doe@example.org",
"agentPicture": "https://example.org/avatar.png",
"agentLastActive": "2020-01-01T00:00:00.000Z",
"department": "Support",
"isBackOffice": "0", // 0 or 1
"groups": "Sales,Support"
}
]
}

grabAgents

Lists all agents.

Parameters

NameTypeDescription
apiKey*StringYour API Key
userId*StringYour userId

Usage

curl -X GET "https://apiv2.imbox.io/message/grabAgents/apiKey/userId"

Response

{
"result": "success",
"json": [
{
"agentID": 1,
"sid": 1,
"agentName": "John Doe",
"agentEmail": "john.doe@example.org",
"agentPicture": "https://example.org/avatar.png",
"agentLastActive": "2020-01-01T00:00:00.000Z",
"department": "Support",
"isBackOffice": "0",
"groups": "Sales,Support"
},
{
"agentID": 2,
"sid": 1,
"agentName": "Jane Doe",
"agentEmail": "jane.doe@example.org",
"agentPicture": "https://example.org/avatar.png",
"agentLastActive": "2020-01-01T00:00:00.000Z",
"department": "Marketing",
"isBackOffice": "1",
"groups": "Marketing"
}
],
"length": 2
}

chatStatistics

Get chat statistics within a given timespan (Maximum 365 days per request).

Parameters

NameTypeDescription
apiKey*StringYour API Key
userId*StringYour userId
startTime*StringFormat: 2020-01-01T00:00:00.000Z
endTimeStringFormat: 2020-01-01T00:00:00.000Z – Default: Current timestamp
agentIdStringAgentId
agentIdsArray<String>Filter by multiple ids
channelStringConversation id / Channel
channelsArray<String>Filter by multiple conversations
fileTypeString”csv”|”json” Default: ”json”
timezoneStringYour userId
pageFilterIdArray<String>Filter using page filters ids

Usage

curl -X GET "https://apiv2.imbox.io/message/chatStatistics/apiKey/userId?startTime=2020-01-01T00%3A00%3A00.000Z&endTime=2020-01-01T00%3A00%3A00.000Z&agentIds=1&agentIds=2&channel=V1"

Response

{
"result": "success",
"json": [{
"channel": "V1",
"agentName": "John Doe",
"agentEmail": "john.doe@example.org",
"referral": "Direct",
"searchEngine": "",
"exitPage": "https://example.org/",
"browser": "Chrome 50.0.0",
"os": "OS X",
"city": "Stockholm",
"country": "Sweden",
"labels": ["label1", "label2"],
"tags": ["tag1", "tag2"],
"duration": 100000, // Chat duration in MS
"rating": 4,
"responseTime": 5000, // Agent response time in MS
"startedAt": "2020-01-01T00:00:00.000Z"
}, {
"channel": "V1",
"agentName": "John Doe",
"agentEmail": "john.doe@example.org",
"referral": "Direct",
"searchEngine": "",
"exitPage": "https://example.org/",
"browser": "Chrome 50.0.0",
"os": "OS X",
"city": "Stockholm",
"country": "Sweden",,
"labels": [],
"tags": [],
"startedAt": "2020-01-01T00:00:00.000Z",
"duration": null, // No answer from agent
"rating": null,
"responseTime": null // No answer from agent
}],
"length": 2
}

pageFilters

List all pageFilters.

Parameters

NameTypeDescription
apiKey*StringYour API Key
userId*StringYour userId

Usage

curl -X GET "https://apiv2.imbox.io/message/pageFilters/apiKey/userId"

Response

{
"result": "success",
"json": [
{
"id": 1,
"sid": 1,
"searchFilter": "searchFilter",
"searchName": "searchName",
"matchType": "like"
}
],
"length": 1
}