What is Raw JSON/Text HSL?
- Getting Started
- Bot Building
- Smart Agent Chat
- Conversation Design
-
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
- External Agent Tool Setup
- Analytics & Reporting
- Notifications
- Commerce Plus
- Troubleshooting Guides
- Release Notes
Let us first understand what a JSON is. It is a specific format in which you can send data in key-value pairs. The values we send through JSON can be of the data type - Number, String, Array, etc.
JSON follows this format -
{ "name": "Daniel", //string "age": 28, //number "phone_number": ["9988667711","9988776611","9988554433"], //array "education": { //object "school_name": "Royal Heritage School" "roll_number": 25 } }
The above format is a very basic example of a JSON structure.
All responses on Haptik's bot are JSONs. One of these responses is a Raw JSON/Text HSL. We can use Raw JSON/Text for the following applications -
- Adding a simple text response.
- Copying a Chat Element from one Step to another Step.
- Adding Custom Chat Element.
Adding a simple text response
We can use the Raw JSON/Text HSL in a Step for adding a simple text response in the Chat Element. When that step gets triggered in the conversation, this text response will be sent by the bot.
Copying a Chat Element from one Step to another Step
Another way to use a Raw JSON/Text HSL is for copying the Chat Elements from one Step to another Step. Once you have copied the JSON from one Step with the help of the COPY JSON button, you can open another Step, and in the Bot Responses section, select the Raw JSON/Text HSL, and paste the JSON, as shown.
Adding Custom Chat Element
Our SDK supports certain HSLs for displaying the Bot Responses, but at times you might want to have your own custom Chat Element, that is when you will be using this RAW JSON/ text HSL. You can enter the Raw HSL JSON directly and that element will be rendered by the bots. Sometimes a custom chat element is not like other standard elements that we support on our SDK.
Consider, you want to add a specific element like a drop-down menu. You will have to write a JSON for that and add it in the Raw JSON/Text HSL. Now, Haptik's SDK doesn't support a drop-down menu chat element. In this case, when the chat triggers the Step that has this drop-down menu HSL configured, the whole JSON will be displayed in the chat, rather than the drop-down menu.
To solve this,
- You can create your own SDK if you don't want to use the Haptik SDK, and configure the required Chat Elements in it. Here, you need to make sure that your SDK supports all the Chat Elements from Haptik's SDK, or else when Haptik HSLs will be triggered, the whole JSON will be displayed in the chat.
- You can choose a channel whose SDK supports all the Chat Elements that are supported by the Haptik SDK, as well as the custom chat elements that you want for your bot.