Home > Integration POST API JSON
Categories: Technical Options
(Last Updated On: )
About This Article
The purpose of this article is to provide a comprehensive overview of the Integration POST API JSON.
Introduction
Have a custom-built integration or third-party application you want chat data sent to? No Problem!
The SnapEngage Integration API allows developers to easily interface SnapEngage with other applications, getting all the data you gather sent to the place you want to keep it. This transaction provides detailed information pertaining to the request and allows developers to recreate the request in the destination system.
SnapEngage can automatically POST events to an external URL when new requests are received for both offline and live chats.
Activate the API
- In the SnapEngage widget configuration, under Settings > Integrations.
- Select the “Integration API” icon.
- Enter the URL (3) of where you want to receive the POST message when a new offline request or live chat is processed by SnapEngage. In the sections below, you can elect to have the transcripts sent via email to a destination of your choice.
- Underneath the Integration URL, you have the option to add an Authentication Token (4), which will be sent via the Authentication Header. This is completely optional, but certain integrations require an Authentication Token for the Integration API to work successfully.
- Once you are done making changes, just make sure to click the “Save” (5) button at the very bottom of the page.
At this time, the event details will be ready to be to parsed out and into your system.
API details
When the API is activated and a new support request is received, SnapEngage will automatically send a POST transaction to the URL specified in the API configuration. The transaction provides details about the support request in a JSON format.
POST event details (sample response JSON):
{
"id": "8b7c3b3b-f5d7-4e58-96d8",
"widget_id": "e8175843-d381-4d7c-aa9f-0da1610ad1b",
"url": "https://www.snapengage.com/viewcase?c=8b7c3b3b-f5d7-4e58-96d8",
"type": "chat",
"requested_by": "test@test.com",
"requester_details":
{
"name": "Jim Tester",
"emails": ["test@example.com"],
"name_profile_link": "http://facebook.com/jimtester",
"phones": ["555-555-1010"],
"address": "111 2nd Ave.",
"address_2": "",
"city": "Boulder",
"state": "CO",
"zip": "80303",
"country": "US",
"company_name": "SnapEngage",
"company_profile_link": "http://facebook.com/snapengage",
"employees": "Abe,Betty,Charlie",
"revenue": "100",
"title": "CEO",
"website": "www.snapengage.com",
"social_profile_links": ["www.facebook.com/jimatsnapengage","www.twitter.com/jimtesteratsnap"],
"gender": "Male",
"age": 44,
"influencer_score": "88.8",
"notes": "This is just for testing",
"industry": "Tech",
"avatars": ["http://www.avatars.com/jimtester"],
"other_data": []
},
"description": "Testing the Integration API...",
"created_at_date": "Oct 3, 2014 2:14:31 PM",
"created_at_seconds": 1412367271,
"created_at_milliseconds": 268,
"proactive_chat": false,
"page_url": "http://www.snapengage.com/demo/integrationapi.html",
"referrer_url": "http://www.comingfromurl.com",
"entry_url": "http://www.yoursite.com",
"ip_address": "67.174.108.196",
"user_agent": "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/532.0 (KHTML, like Gecko) Chrome/3.0.195.27 Safari/532.0,gzip(gfe)",
"browser": "Chrome (3.0.195.27)",
"os": "Microsoft Windows Vista",
"country_code": "US",
"country": "United States",
"region": "16",
"city": "Boulder",
"latitude": 39.914700,
"longitude": -105.080902,
"source_id": 2,
"chat_waittime": 2,
"chat_duration": 15,
"chat_ended_by": "agent",
"language_code": "en-US,en;q=0.8",
"transcripts": [
{
"id": "",
"date": "Oct 3, 2014 2:14:31 PM",
"date_seconds": 1412367271,
"date_milliseconds": 154,
"alias": "visitor",
"message": "Hola, ",
"translations": {
"en": "Hello,"
},
"sender": "VISITOR"
},
{
"id": "jerome@snapengage.com",
"date": "Oct 3, 2014 2:14:31 PM",
"date_seconds": 1412367271,
"date_milliseconds": 456,
"alias": "test",
"message": "Good day",
"translations": {
"es": "Buen día"
},
"sender": "AGENT"
},
{
"id": "",
"date": "Oct 3, 2014 2:14:31 PM",
"date_seconds": 1412367271,
"date_milliseconds": 835,
"alias": "visitor",
"message": "Esto es una prueba.",
"translations": {
"en": "This is a test."
},
"sender": "VISITOR"
}
],
"javascript_variables": [{
"name": "variable1",
"value": "v1_1234"
}, {
"name": "variable2",
"value": "v2_123456789"
}],
"operator_variables": [{
"name": "note",
"value": "this is a note entered by the agent"
}, {
"name": "customerTemp",
"value": "Very Happy"
}],
"labels": [{
"name": "note",
"value": "this is a note entered by the agent"
}, {
"name": "customerTemp",
"value": "Very Happy"
}]
}
Additional information
The target system needs to respond with and HTTP 200 to confirm that the event has been received and processed. In the absence of a successful HTTP response, SnapEngage will retry the HTTP POST automatically for approximately 2 hours before sending it through email and flagging the event as sent.
To open uploaded files during the chat, you need to be signed in as SnapEnage admin or agent of the widget where chat happened.
If you access files within your target system by doing GET HTTP call, it must satisfy following:
– only https protocol
– has “orgId” parameter with your Organization ID value
– has “Authorization” header with your API Token value
OrgID and API Token can be found or generated in “My Account” section of the dashboard.
Otherwise, you will have no permission to access those files.
For greater detail about the JSON values, please see our page on Support Request JSON Details
For legacy users of the Integration API, you will still receive the support request in XML format. For reference, please refer to the POST API (legacy XML) document.
Published October 3, 2014