LogoLogo
WebsiteGuide & TutorialBlogBook a Demo
1.0.0
1.0.0
  • Acquire Developers Hub
  • Acquire
    • Acquire Build Requirement
      • Requirement For Acquire
      • Acquire Speedtest
  • JS API
    • JS Live Chat API
      • Description
      • Installation
      • Visitor
      • Thread
      • Conversation
      • User Verification
    • Quick Link Support
      • One Click Button
      • Social Media Share
    • Backend JS SDK
      • Setup Backend JS SDK
      • Demo Backend SDK
    • Advanced
      • Widget UI
      • Reference
  • Co Browse APIs
    • Acquire Co Browse
      • Co Browse API
  • Acquire API Events
    • WebRTC Related Events
  • iOS
    • SDK Setup Guide
      • Getting Started
      • Integration Guide (Core)
      • Integration Guide (Lite)
      • Manual Setup iOS
      • Acquire Account ID
    • SDK Configuration Example
    • iOS Cobrowse
    • Theme Setting
    • iOS Push Notifications
    • Verify your users
  • Android
    • Getting Started
      • Integration Guide (Core)
      • Integration Guide (Lite)
      • Start using Acquire
    • Acquire APIs
    • Acquire Delegates
    • Custom UI/widget
    • Cross Platform Integrations
  • Webhook API
    • Webhooks Basic
      • Introduction
      • Webhook Integrate Steps
      • Webhook Format
    • Webhook Events
      • On Chat Start
      • On Chat Accept
      • On Chat Message
      • On Chat Close
  • REST APIs
    • OAuth
      • Authorization
      • Tracklog
    • Profiles API
      • Profile List
      • Thread
      • Feedback
      • Profile Details
      • Message
      • Tags
      • Profile Agents
      • Campaigns
      • Profile Add Update
      • Profile Delete
      • Profile Visit History
      • Sender Emails
    • Chat
      • Chat Notes
    • Analytics
      • Chat Statistics
      • Team Analytics
      • Conversion Rate
      • Chat Tag
      • Co browsing
    • Agent
      • Agents List
      • Agent add
      • Edit / Get-agent
      • Update
    • Trigger
      • Triggers List
      • Triggers Detail
    • Operating Hours
      • Save Operating Hours
      • Get Operating Hours
    • Cobrowse
  • Chatbot API
    • Chat Bot
      • Integrate Your Chatbot
      • Dialog Flow V1 Chat-Bot
      • Dialog Flow V2 Chat-Bot
      • Dialog Flow Fulfillment & Custom Response
      • IBM Watson Integration
      • Amazon Lex Bot
      • Azure's QnA Maker
      • Webhook Calling & User Verification
      • Webhook For Reset Password
  • Knowledge Base APIs
    • Help Docs Setup
      • Get FAQ Categories
      • Get Setup Details
      • Get Side List
      • Get Article
      • Get Recent Article
      • Get Categorized Articles
      • Get Suggestion
  • Errors
    • API Error Handling
      • HTTP Responses
Powered by GitBook
On this page
  • Widget Installation
  • Additional Setup
  • Webhook Creation
  • Use of Webhook
  1. Chatbot API
  2. Chat Bot

Webhook Calling & User Verification

PreviousAzure's QnA MakerNextWebhook For Reset Password

Last updated 4 years ago

Widget Installation

First of all we have to setup our site with “Acquire” chat widget. You can get the “chat widget code” from “Installation” option under “Settings” menu.

Additional Setup

First of all, we create a hidden field in “chat form”, it will store visitor’s information, that will be helpful to identify that user. In screenshot we setup hidden field with name v_id.

Then after we open our website where Acquire’s chat widget is enabled, and provide visitor’s info with it. We made a blank php page and provide visitor’s id along with URL.

URL: /chat_widget.php?id=35

We use this id and build a hash_hmac value from this id. Then resultant value will be push to acquire object. Like: user_hash: ‘<?php echo $hashVal ?>’

Important : Use HMAC only Server side not use client side and Keep your secret key safe!

Now our chat widget is fully set up. Let's make a webhook now.

Webhook Creation

Now we make a webhook API, i.e. Get premium amount, Get expiry date & etc. Whenever we call this webhook API, we will get huge data about visitor in body of that particular API. Like: hash, visitor_id, chat_id, visitor’s name, visitor’s email, browser details, custom fields value, other misc details.

We can use v_id and hash in our webhook. Again we can make hash value $new_hash from $v_id by use of your secret key and match it with $init_hash . If it matched with it then we able to know that this visitor is authenticated.

Now we add link of this webhook in Bot’s Webhook APIs Library with a variable name. Make sure you make variable name as you used in webhook. For example: we create a webhook API with response { ‘premium_amount’ : ’Your premium amount is 5410 rs.’ } then in below popup box, we have to make variable name as premium_amount. You can find this at “Chatbot > Setting > Webhook APIs”.

Now our webhook variable is set up.

Use of Webhook

Now we add a question in Support Bot like:

We will use webhook variable as answer of bot. So whenever we ask this question to bot then bot call that webhook and replace this variable with API response. See widget image on next page.

To identify every visitor, we have to put Visitor Authentication functionality with widget code. Authentication code will produce HMAC Code, that verify the identity of that visitor i.e. visitor_id. HMAC code will be assigned with an attribute, named as user_hash. Find more details on this link:

https://developer.acquire.io/js-api/js-live-chat-api/user-verification