Chat HTTP API

Chat Server URL: https://chatserver.alo-tech.com

 

  • AUTHORIZATION

An authentication token will be generated during creating chat widget. Send this security token with new request to authenticate your app.

 

  • START NEW CHAT

You can use this endpoint to start a new chat. Parameters other than the cwid (chat-widget-key), client_name, security_token and namespace are optional. If lang parameter is not pass, the default value will be same as tenant.

The token value returned in response is required for send messages, receive messages, and chat end APIs.

1 2 3 4 5 6 7 8 9 10 11 12 POST /chat-api/new { "cwid": "chat-widget-key", "security_token": "security-token-from-chat-widget", "namespace": "namespace", "client_name": "client-name", "client_email": "client-email", "phone_number": "phone-number", "customer_path": "customer-path", "custom_data_id": "custom-data-id", "lang": "lang" }

Response

1 2 3 4 5 { "success": true | false, "token": "token-string", "active_chat_key": "active-chat-key-string" }

 

  • SEND MESSAGE

You can use this endpoint to send a message to the agent. Only text messages can be sent for now.

1 2 3 4 5 POST /chat-api/put_message { "token": "token-string", "message_body": "text" }

Response

1 2 3 4 5 6 7 8 { "success": true | false, "active_chat_key": "active-chat-key-string", "type": "text", "msg_id": "msg-id", "insert_date": {"date": "DD-MM-YYYY", "time": "HH:MM:SS"}, "message_status": "sent" }

 

  • GET MESSAGE

You must define an endpoint from Chat Widget to receive new messages. You will receive a POST request for each message.

 

You can receive agent messages via the /chat-api/get_message endpoint. Response will return as objects in list.

1 2 3 4 POST /chat-api/get_message { "token": "token-string" }

Response

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 [ { "active_chat_key": "active-chat-key-string", "text": "text-message", "type": "text", "msg_id": "msg-id", "sender": "agent", "name": "client-name", "chat_type": "http-api", "insert_date": {"date": "DD-MM-YYYY", "time": "HH:MM:SS", "now": "YYYY-MM-DD HH:MM:SS.f"} }, { "active_chat_key": "active-chat-key-string", "text": "text-message", "type": "text", "msg_id": "msg-id", "sender": "agent", "name": "client-name", "chat_type": "http-api", "insert_date": {"date": "DD-MM-YYYY", "time": "HH:MM:SS", "now": "YYYY-MM-DD HH:MM:SS.f"} } ]

 

  • END CHAT

1 2 3 4 POST /chat-api/end { "token": "token-string" }

Response

1 2 3 { "success": true | false }