NAV Navbar
curl

Start new chat

Start a new Chat. Please see the cURL tab to the right for an example.

POST /api/v1/chat

Request Parameters

Data Type Description
widgetId String Required. Unique identifier of the widget.
email String (Required if emailRequired is true for chat widget) Visitor’s email address.
phone String Visitor’s phone number.
userAgent String Similar to web browser user agent string.
locale String Locale of this chat session. Example could be “en” or “en-GB”.
isOffline Boolean true/false – Open chat session or send message directly to email (offline). Default is false.
appVersionName String Name/Version of your application.
visitorMessage String (Required if messageRequired is true for chat widget) Initial visitor chat message.

Sample Request

Please see the cURL tab to the right for an example.

// NOTE: Make sure to replace the "{api_key}" below with your API key!

curl -X POST \
  'https://www.snapengage.com/api/v1/chat?widgetId=5286374d-5c92-419d-bcdb-b926d242b78b&[email protected]&phone=555-123-4567&userAgent=Mozilla/5.0%20%28Macintosh;%20Intel%20Mac%20OS%20X%2010_8_2%29%20AppleWebKit/537.17%20%28KHTML,%20like%20Gecko%29%20Chrome/24.0.1309.0%20Safari/537.17&locale=en&isOffline=false&appVersionName=My%20Mobile%20App&visitorMessage=hello' \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -H 'x-api-key: {api_key}'

Response Parameters

Data Type Description
caseId String Unique identifier of chat session.
widgetId String Unique identifier of chat widget.

Success Response

200 OK

Please see the json tab to the right for an example.

{
    "caseId": "ca5e3eca-8659-44a7-89fd-2f0b4dd71fa6",
    "widgetId": "5286374d-5c92-419d-bcdb-b926d242b78b"
}