Streaming API - Eventing API (Webhooks)

Is there a way for LiveHelpNow to push customer data such as Name, Email, Chat transcript, Offline message, etc. to my contact management system automatically, in realtime?

* This article should be read by a developer in your organization

 

 
Introducing LiveHelpNow Eventing API (Webhooks)
No more manually calling an API, no more transfer delays, and no more frustrated developers. Eventing, which acts as a Streaming API, will allow you to receive fully customizable data and push it to any resource on the web at the exact moment a LiveHelpNow event such as a chat starting or a chat closing occurs.


 
 
How does LiveHelpNow Eventing API work?
 When an event you have subscribed to, such as "Chat Opened", "Chat assigned", "Chat Closed", "Offline Message", etc. occurs for your account, a payload is constructed per your instructions with data formatted in the way you want and is sent to the resource on the web you have setup to receive the payload and process it.


 
 
I'm excited! How do i set it up?
  1. Login to your account and go to Admin Panel->Integrations & Partners -> Webhooks 

  2.  Click on "Add Event"
  3. Select Event, Event Type, Verb, Headers (optional), Construct your payload by clicking on available tokens for the event.
    Provide URL to submit the data to.

    * We highly recommend to enable "Test" mode for the event and test the event first. While in test mode, the Event will email you the PayLoad so you can see whether the format is what you expected and then switch Event to live mode by unchecking "Test" mode and have the data sent to your "Live" URL for processing.
    Eventing API setup

 

How do i properly receive the data?
The PayLoad is sent as InputStream
Here's PHP example on how to receive InputStream data:
<?php

// To access your headers being sent
$headers = array();
foreach($_SERVER as $headerName => $headerValue){
	if(substr($headerName, 0, 5) == "HTTP_"){ // This will eliminate no request headers
		array_push($headers, array($headerName, $headerValue));
	}
}
// The $headers variable will now contain all HTTP Request headers within a multidimensional array

// The variable below with get the payload from the LiveHelpNow Eventing API 

$payload = $HTTP_RAW_POST_DATA;

?>
Here's ASP.NET example showing reception of InputStream.
VB
Private Function RequestInputStreamToString(oStream As System.IO.Stream) As String
        Dim sb As New System.Text.StringBuilder()
        Dim streamLength As Integer
        Dim streamRead As Integer

        streamLength = Convert.ToInt32(oStream.Length)
        Dim streamArray As [Byte]() = New [Byte](streamLength - 1) {}

        streamRead = oStream.Read(streamArray, 0, streamLength)

        For i As Integer = 0 To streamLength - 1
            sb.Append(Convert.ToChar(streamArray(i)))
        Next

        Return sb.ToString()
End Function


Response.Write(RequestInputStreamToString(Request.InputStream))
C#
private string RequestInputStreamToString(System.IO.Stream oStream)
{
	System.Text.StringBuilder sb = new System.Text.StringBuilder();
	int streamLength = 0;
	int streamRead = 0;

	streamLength = Convert.ToInt32(oStream.Length);
	Byte[] streamArray = new Byte[streamLength];

	streamRead = oStream.Read(streamArray, 0, streamLength);

	for (int i = 0; i <= streamLength - 1; i++) {
		sb.Append(Convert.ToChar(streamArray[i]));
	}

	return sb.ToString();
}

Response.Write(RequestInputStreamToString(Request.InputStream))
 
 
The following is the complete list of data values available to be sent with a payload for each event type:
 
Chat Opened  Chat Assigned  Chat Closed 
Customer Data
Country
Custom info feed (value 1)
Custom info feed (value 2)
Custom info feed (value 3)
Customer language
Date of last visit, if any
Department ID
Host Name
IP Address
ISP Company Name
Keywords used if referrer is a search engine
Number of pages visited
Operator notes
Referrer URL
Visitor current page
Visitor entry page
Visitor ID
Visitor referral source

Browser Data
Browser Name
Browser platform
Browser Version
Java enabled
Screen resolution

Chat Data
Chat session unique ID
Chat window ID
Customer email
Pre-chat form values (Field 1)
Pre-chat form values (Field 2)
Pre-chat form values (Field 3)
Pre-chat form values (Field 4)
Customer first name
Customer last name
Customer full name

 

Customer Data
Country
Custom info feed (value 1)
Custom info feed (value 2)
Custom info feed (value 3)
Customer language
Date of last visit, if any
Department ID
Host Name
IP Address
ISP Company Name
Keywords used if referrer is a search engine
Number of pages visited
Operator notes
Referrer URL
Visitor current page
Visitor entry page
Visitor ID
Visitor referral source

Browser Data
Browser Name
Browser platform
Browser Version
Java enabled
Screen resolution

Chat Data
Chat session unique ID
Chat window ID
Chatting Operator Email
Chatting Operator ID
Chatting Operator Username
Custom ID
Customer email
HubSpot ID
Phone ID
Pre-chat form values (Field 1)
Pre-chat form values (Field 2)
Pre-chat form values (Field 3)
Pre-chat form values (Field 4)
SalesForce ID
Customer first name
Customer last name
Customer full name

 

Customer Data
Country
Custom info feed (value 1)
Custom info feed (value 2)
Custom info feed (value 3)
Customer language
Date of last visit, if any
Department ID
Host Name
IP Address
ISP Company Name
Keywords used if referrer is a search engine
Number of pages visited
Operator notes
Referrer URL
Visitor current page
Visitor entry page
Visitor ID
Visitor referral source

Browser Data
Browser Name
Browser platform
Browser Version
Java enabled
Screen resolution

Chat Data
Chat session unique ID
Chat transcript URL
Chat window ID
Chatting Operator Email
Chatting Operator ID
Chatting Operator Username
Custom ID
Custom Identifier 1
Custom Identifier 10
Custom Identifier 2
Custom Identifier 3
Custom Identifier 4
Custom Identifier 5
Custom Identifier 6
Custom Identifier 7
Custom Identifier 8
Custom Identifier 9
Customer chat transcript
Customer email
HubSpot ID
Phone ID
Pre-chat form values (Field 1)
Pre-chat form values (Field 2)
Pre-chat form values (Field 3)
Pre-chat form values (Field 4)
SalesForce ID
Customer first name
Customer last name
Customer full name
Chat start time
Chat end time

 
 
Should you have any questions or concerns please do NOT hesitate to chat with us or submit a ticket for support. We are here to help!
 

Leave a comment?

0 Comments
Login
REGISTER WITH EMAIL

Related articles