Tutorial: how to setup webhooks for LiveChat


A quick tutorial on how to set up webhooks on LiveChat using the LiveChat Developer console LiveChat Developer Console – Build and Monetize Apps

Step 1. Go to LiveChat Developer Console – Build and Monetize Apps.

Step 2. Go to the Building Blocks section of the newly created app, add the “App Authorization” block with “Client type”; add webhooks.state:rw scopes to the Authorization block.

Step 3. Go to the Building Blocks section again, add " Chat Webhooks" block. Put the link to your website (e.g., https://webhook.site/051c3fe2-2157-4eb5-8719-fb034fc5bd77) and select events you want to “listen” (incoming_chat or incoming_event).

Step 4. Go to the Private Installation section and click “Install”.

Step 5. Open the following link in browser https://accounts.livechat.com/?response_type=token&client_id=CLIENT_ID&redirect_uri=REDIRECT_URL, where CLIENT_ID and REDIRECT_URL can be found in Authorization block from Step 2 (make sure that REDIRECT_URL is properly encoded). If everything went okat, you should be redirected to following url: REDIRECT_URL#access_token=ABC123&expires_in=28800&scope=webhooks.state%3Arw&token_type=Bearer. ABD123 is encoded access token, use decodeURIComponent to decode it.

Step 6. Enable webhooks on the license using the following request (more here):

curl -X POST \
  https://api.livechatinc.com/v3.4/configuration/action/enable_license_webhooks \
  -H 'Authorization: Bearer <access_token>' \
  -H 'Content-Type: application/json' \
  -d '{}'

Good luck :crossed_fingers: