External App Integration API

For 3rd party applications to send messages to customers. This API is used by Campaign Manager and similar applications. 

​4.0.1​ Message API

The message REST API is used to send a message (such as a campaign message) to customers on different channels via chat server. The message will be submitted to the chat server via this API. The chat server will transmit this message to the connector of the channel specified in the REST call. If the connector is not connected to the chat server, the server will return the status 503 for the request.

Protocol

HTTP

URL

http://<FQDN>/api/external/message

Content Type

Application/JSON

HTTP Method

POST

Input/Output Format

JSON

Request Body

Following are the allowed parameters in the Request body.

channel - Channel ID, a connector must be connected with Chat Server with this channel.

messageId - a unique string to identify the message

destination - the reference of the customer, to which this message will be delivered. Mobile number in case of SMS, facebook account id in case of Facebook message.

from.id - the id of campaign or sender agent

from.name - the display name of campaign or sender agent.

from.app - name of the application which is sending the message.

text - text content of the message to be delivered.

timestamp - in the ISO 8601 format.

Sample Request Body


{

"channel": "sms",

"messageId": "abbcda323",

"destination": "3015642191",

"from": {

  "id": "sales_2018_winter",

  "name": "Sale Campaign",

  "app": "Expertflow Campaign Manager"

},

"timestamp": "2018-11-23T08:51:28.255",

"text": "Expertflow campaign message"

}

HTTP Response

200: Success

500: Internal Server Error

503: Service Unavailable

Response Header

requestId - Chat server will respond with requestId in the response header, this id can be used to cross check the logs in both systems.

​4.0.2​ Agent API

The  REST API is used to get the active agents list along with their state and attributes.

The server responds with a list of active agents. Please note that this API will not return supervisor users.

Protocol

HTTP or HTTPS

URL

http://<FQDN>/api/external/agents/list

or

https://<FQDN>/api/external/agents/list

Content Type

Application/JSON

HTTP Method

GET

Input/Output Format

JSON

HTTP Request

-

Request Parameters


HTTP Response

200: Success

404: Not found

500: Internal Server Error

503: Service Unavailable

Example Response

[  

  {  

     "id":"5c88a4d32cc50463a0787a9b",

     "agentId":"faisal",

     "state":"READY",

     "firstName":"Faisal",

     "lastName":"Nawaz",

     "attributes":[  

        {  

           "createdDate":"2019-03-13T07:00:31.189Z",

           "_id":"5c88aa8f3cdebc7f01c5c428",

           "__v":0,

           "name":"Sale",

           "description":null,

           "type":"Boolean",

           "value":"false",

           "usageCount":null

        }

     ]

  },

  {  

     "id":"5c88a4d32cc5046cd3787a9c",

     "agentId":"awais",

     "state":"NOT_READY",

     "firstName":"awais",

     "lastName":"aslam",

     "attributes":[  

       

     ]

  }

]