Introduction

Hi, Developer!

This tutorial will help you intergrate your tools with Tagove Chat using webhooks. To use Tagove webhook service, you need to complete the following steps:


Step 1: Sign Up for a free trial account.

This trial account will serve the purpose of sandbox testing for your intergration.

Step 2: Create webhooks and let us know.

Use this documentation to create webhooks and test them with your intergration.




Webhooks


You can configure Tagove chat to instantly notify to about particular events that are happening in your chat. Such notification is called a webhook. Its is just a simple POST request that is send to your server when a particular event occurs.



Setting up the webhooks


You can create your webhooks in Tagove web application.


Each webhook contains the following properties:

  • Title - Represents your webhook in simple text.

  • Url - Address of the web server at which webhook will be sent to.

  • Status - Determines whether your webhook is 'Active' or 'Disabled'

  • Triggers - Determine when the webhook is sent to server.



Webhook Format


Each webhook is a HTTP POST request made to the URL that you provide in the web app. The request's POST body contains webhook information in JSON format.


Each webhook contains the following properties:

  • data - Data contains webhook data related to webhook trigger in JSON format

  • event - Determine the event associated with the webhook


When your server receives a webhook from Tagove, it should respond with HTTP 200 response. Otherwise, Tagove will retry sending the webhook to your service for 5 more times unless it receives the correct HTTP 200 response.


Note: LiveChat webhooks are sent with Content-Type: application/json header, so please make sure that your service can handle such requests.


{
    "data": {
        "id": 405289,
        "message": {
            "type": "message",
            "msg": "hello",
            "user": {
                "id": 41404557,
                "type": "visitor",
                "name": "#41404557",
                "photo": null
            }
        }
    },
    "event": "CHAT_ON_MESSAGE"
}
                

Example Integrations


Here are some ideas for using Tagove webhooks:

  • read additional information about your visitors from your database and send it back to the LiveChat app,

  • display a warning message on your internal statusboard when your website visitors start queueing before the chat,

  • save each chat transcript in the external system.



Webhook Event Types


In some cases, you may want to get some additional information when the particular event occurs.


For example, when the chat starts, you may want to know the visitor's name and e-mail. To get this information, you can parse webhook data send to your server as described following.



On Chat Start


On chat start, you want to get data like visitor name, email and phone as provided in pre-chat survey, which can be used to keep record of visitor on website in the format you like.


You can also use visitor info to communicate with your visitors after chat is over.


This data is send to your web server as JSON provided in the webhook with trigger CHAT ON START selected at Tagove dashboard.



{
  "data": {
    "id": 421100,
    "account_id": 172,
    "visitor_id": "41788782",
    "session_id": "41788682",
    "type": "text",
    "details": {
        "name": "John",
        "email": "John@gmail.com",
        "phone": null,
        "remarks": "Test",
        "meta": "_by:agent"
    },
    "status": "pending",
    "date_created": "2017-09-20 10:17:08",
    "date_updated": "2017-09-20 10:17:08",
    "department_id": ""
    },
    "event": "CHAT_ON_START"
}
                

On Chat Message


On chat message, you want to get chat message, session details and visitor details which you can use to keep a repository of chat at your server.


This trigger send JSON data to your web server, as show following.



{
  "data": {
   "id": 403289,
   "message": {
         "type": "message",
         "msg": "hello",
         "user": {
             "id": 41304557,
             "type": "visitor",
             "name": "#41404557",
             "photo": null
        }
    }
  },
  "event": "CHAT_ON_MESSAGE"
}
                

On Chat Close


On chat close, you want to know the chat duration and wait time for chat, which you can use to estimate the chat seats you needed with changing demands to your business to serve your customer better and more quickly.


This trigger will send this data to your server as JSON.



{
  "data": {
   "id": 404278,
   "chat_duration": 0,
   "chat_wait_time": 271,
   "by": "visitor-41104557"
   },
   "event": "CHAT_ON_CLOSE"
}