Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Go to Haptik Website
  • Contact Us
  • Home
  • Deployment
  • Web SDK

How to set up a launch message on my website bot?

Written by Medha Anand

Updated on December 21st, 2022

Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Getting Started
    Build Deploy Analyse Manage Account Bot Deactivation
  • Bot Building
    Essentials Smart Skills Steps User Messages Bot Responses Entities Connections Customisations User feedback collection Testing Whatsapp Bots NLU Bot Maintenance
  • Smart Agent Chat
    Set up Admin Settings MyChats Section (Agent Inbox) Live Traffic Section Teams Section Archives Section Analytics Plans on Smart Agent Chat
  • Conversation Design
    Design Basics Design Guides Designing for Platforms Designing WhatsApp Bots
  • Developer Guides
    Code Step Integration Static Step Integration Shopify Integration SETU Integration Exotel Integration CIBIL integration Freshdesk KMS Integration PayU Integration Zendesk Guide Integration Twilio Integration Razorpay Integration LeadSquared Integration USU(Unymira) Integration Helo(VivaConnect) Integration Salesforce KMS Integration Stripe Integration PayPal Integration CleverTap Integration Fynd Integration HubSpot Integration Magento Integration WooCommerce Integration Microsoft Dynamics 365 Integration
  • Deployment
    Web SDK WhatsApp Facebook Instagram Sunshine Conversation LINE Google Business Messages Telegram MS Teams Bot as an API iOS SDK Android SDK
  • External Agent Tool Setup
    Zendesk Chat Salesforce Service Cloud Freshchat Zoho NICE CXOne Gorgias
  • Analytics & Reporting
    Intelligent Analytics
  • Notifications
    SMS Notifications Success Measurement
  • Commerce Plus
    Catalog Integration Bot Building Guide Channel Deployments Unified ML Pipeline Documentation
  • Troubleshooting Guides
    Error Messages FAQs
  • Release Notes
+ More

Table of Contents

Table of Contents launchTask(taskId, callback) launchMessage(message, callback, hidden) Sample snippet

Table of Contents

launchTask(taskId, callback)launchMessage(message, callback, hidden)Sample snippet

You can launch the Bot with a task or message on behalf of the user. Haptik provides the following methods for doing so.

launchTask(taskId, callback)

Launches the SDK and automatically sends specified taskId as a user message (The same message that would be sent if the user tapped on that task)

Params:

  • taskId <Number>The task id is specified in the tasks section of the bot builder (business manager)
  • callback <Function>(optional)The callback executes once the call completes. The callback function is executed with success the boolean flag as a parameter indicating whether the call was completed or failed.

launchMessage(message, callback, hidden)

Launches the SDK and automatically sends a specific message as a user message. It can optionally be sent as a hidden user message

launchMessage() that opens the bot automatically on page load.

Params:

  • message <String>The message that is to be sent
  • callback <Function>(optional)The callback executes once the call completes. The callback function is executed with success boolean flag as a parameter indicating whether the call was completed or failed.
  • hidden <Boolean>Whether to send the message as a hidden user message. A hidden message is not visible to the user but can be seen by the agent or bot

Sample snippet

The following snippet is an example of how the launch message is sent to the bot. There needs to be a start step created on the bot which will get triggered once the launch message is sent.

The example is for an eCommerce bot, here "Track my order" is the default message that is sent to the bot. "Track my order" should trigger a start step on the bot to start a new conversation.

<html>
 <head>
 <title>Haptik JS SDK Integration Demo</title>
 <meta charset="UTF-8" />
 <meta content="width=device-width; initial-scale=1.0;" name="viewport" />
 </head>
 <body>
 ...Some HTML Code Snippet...
 <script
 type="text/javascript"
 charset="UTF-8"
 src="https://toolassets.haptikapi.com/platform/javascript-xdk/production/loader.js"
 ></script>
<script>
 window.haptikInitSettings = {
 "business-id": <View Credentials>, ##Click on "View Credentials" and get the required values
 "client-id": <View Credentials>, ##Make sure to have the client-id in double quotes as its a string
 "base-url": "https://staging.hellohaptik.com/",
 };
 document.addEventListener('haptik_sdk', function () {
 HaptikSDK.launchMessage("Track My Order",callbackFunction(),false);
 function callbackFunction(){
 }});
 </script>
 </body>
 </html>

When the launch message is sent every time when the user clicks on the Lets chat button -

Declare a boolean global variable "isMessageSent" and add an if condition that only if the variable value is false, the launch message method will be called and then set the variable value as true. This way for a particular session, we can send the launch message just once.

If we don't have the button click, and the user is a logged-in user, the best way is to call the launch message inside the custom sign-up method only when the custom sign-up is successful.

If we don't have a button click and the user is a guest user, then call the launch message directly below the init settings.

Was this article helpful?

Yes
No
Give feedback about this article

Related Articles

  • How to deploy a bot on my website?
  • How to deploy a logged-in bot on my website?
  • How to keep my website bot always open?
  • Which all browsers is my website bot compatible on?

Platform

  • Conversation Studio
  • Smart Skills
  • Advanced NLU
  • Intelligent Analytics
  • Omnichannel
  • Smart Agent Chat
  • Enterprise Security
  • Integrations

Solutions

  • Conversational Commerce
  • Lead Generation
  • Customer Care
  • WhatsApp
  • Conversational IVR
  • Google Business Messages

Industries

  • Retail/ E-Commerce
  • Financial Services
  • Travel & Hospitality
  • Telecom

Knowledge

  • ROI Calculator
  • Reports & Research
  • Case Studies
  • Webinars
  • ISAT
  • Tech Blog
  • Business Blog
  • Resources
  • Haptik v/s Yellow
  • Haptik v/s Liveperson
  • Haptik v/s IBM Watson
  • Haptik v/s Verloop
  • Conversations on AI

Company

  • Why Haptik
  • About Us
  • Careers
  • News & Media
  • Awards & Recognition
  • Contact Us
  • Partnerships
  • Investor Relations

Subscribe

Sign up to recieve the latest updates

Find us on

  • Twitter-footer
  • Linkedin-footer
  • YT-footer
  • Insta-footer
  • G2-footer
  • Facebook-footer

Knowledge Base Software powered by Helpjuice

Copyright © jio Haptik Technology Limited 2021 | Data Security & Privacy Policy | GDPR

North America | Asia Pacific | Africa | enterprise@haptik.ai

Definition by Author

0
0