Webhooks integration guide
NOTE: This help article is intended for customers on our self-serve level of service. If you are an Olark Pro customer, your integration likely will work differently. Please reach out to pro@olark.com for help with setting up your integration.
Using a webhook is a simple way to take the content of an Olark chat transcript and process it for use on your own server. For example, you could add it to your own custom CRM, push it into your marketing automation platform or even perform additional analytics on every conversation.
Setting up a webhook integration
- Create a webhook endpoint. A webhook endpoint is a URL on your server that will receive each transcript when a conversation completes, e.g. http://www.yourhost.com/olark_endpoint.php
- When you finish a live chat, Olark makes HTTP POST to the endpoint you specified. The POST has a single data field containing the JSON-encoded transcript.
JSON encoded transcript
Here is an example of what a JSON-encoded transcript might look like. You can populate the customFields data using our Javascript custom fields API:
Simulating a POST
You can use curl to simulate a POST from our webhook integration to your endpoint like this:
Offline message JSON
Olark can also send offline messages collected while you're logged out of chat. Here is what a JSON-encoded offline message may look like:
- Enter the address to your webhook endpoint on our integration page, and click Save.

Testing
Click the Send test button to ensure your endpoint is configured properly.

You're all set! Now you can type !lead while chatting to post the conversation to your webhook endpoint. If a conversation continues after you send !lead, we'll do another POST to your endpoint when the conversation finishes. The conversation will have the same ID. Alternatively, you can select the option to have all transcripts sent automatically without needing to type a command into chat.
Return JSON
Your endpoint can then return JSON containing the link generated by your CRM. For example:
This is the URL that is shown to the agent when using the !webhook or !lead or !case commands.
Extra Events Extension
Aside from the webhook calls outlined above, we also support some additional events. Since existing webhooks might not expect these extra events, they are only triggered when explicitly enabled on https://www.olark.com/settings/integrations/webhooks.
These new events will include the field "eventType" at the top level of their JSON payload to identify the type of event.
Start Event
Description: Triggered once when a conversation starts.
Event Type Value: start
Example Payload: Same as a normal payload (omitting information not yet available), but including the appropriate eventType field. Example:
Expected return value: Either empty or a JSON dictionary indicating the integrationUrl.
Example:
Whitelist IP's
Although it's generally not necessary, you can filter using these IP's:
Please note that these addresses are in CIDR notation