📘
Sinch | Documentation Global
  • Introduction
  • Glossary
  • GETTING STARTED - MENU
    • Sinch Messaging Platform
      • Login, Language & Menu
      • Account & Settings
      • Dashboard
      • Contacts
      • Groups
  • Credits and limits
    • Signing of plans
    • Limits
  • Send a message
    • Send a fast message
    • How to Send a Message
    • How to Set Up a File
    • Mapped errors
    • Campaigns
    • Correlation ID
    • Tracking Sent Messages
    • Cancelling a Message
    • Character Limit Setting
    • MM2: New Report: Chat (MT + MO)
    • SMS Report > RCS
  • Reports
    • Viewing & Exporting Reports
      • New WhatsApp Conversation report
      • Getting to know the new reports
    • Saved Reports
    • WhatsApp Lists
    • Billing Report
  • Permission
    • System User Role
    • Managing Customers | Subaccounts
    • Permission Levels
    • Subaccounts & Users
    • IP Restriction
    • Two-step Verification
  • SMS
    • SMS Template
    • SMS BOT
  • RCS
    • RCS (Native)
  • WHATSAPP
    • WhatsApp Embedded Signup
      • Prerequisites
      • Registering your WhatsApp Number
      • Verifying your Company on Business Manager
      • Potential Errors During the Embedded Signup Flow
    • Human Assistance Policy
    • WhatsApp Guidelines
    • Instructions & Good Practices
      • Channel Rules
      • Learn More About Tiers
      • Good Practices
    • WA Template - What Is It?
    • Registering a Template
    • Deleting a WA Template
    • WhatsApp Account Settings
    • WhatsApp Dashboard
    • Tech Providers - What is it and how does it work?
  • IA CONVERSATIONAL
    • Planning your bot
    • Creating a new bot
    • Adding content to your bot
      • Detecting information in expressions
      • Asking user info through input validation
      • Flow navigation with variables
    • Bot dialogs
      • Bot message
      • Go To
      • Input Validation
      • Action
    • Publishing & platform URLs FAQ
  • TECHNICAL DOCUMENTATION
    • API & Integrations
      • Introduction - Integrations
      • SMS API
      • Email API
      • Fallback API
      • WhatsApp API
      • WhatsApp Groups API
      • Listing Message Templates
      • WhatsApp Interactive API
      • WhatsApp Lists via API
      • WhatsApp Messaging via SFTP
      • Campaigns API
      • TTL - Time to Live
      • Webhook
  • SUPPORT
    • Status
    • Glossary - Status Page Components
    • Support
  • STATUS PAGE
    • Components status page
      • Integrations
        • SMPP
        • Web service API
        • Web Interface
      • Callback / Delivery Report
        • Webhook DLR (delivery to handset)
        • SMPP DLR (delivery to handset)
        • SMPP Callback (delivery to carrier)
        • Webhook Callback (delivery to carrier)
      • OPERATORS
      • WhatsApp Sending messages to the user (MT)
        • Internal Queues MT
      • WhatsApp Receiving User Messages (MO)
        • Internal Queues (MO)
Powered by GitBook
On this page
  • Clear Session
  • Send to offload provider
  • API
  • Code
  • iframe
  • JSON Builder
  • Website window events

Was this helpful?

  1. IA CONVERSATIONAL
  2. Bot dialogs

Action

PreviousInput ValidationNextPublishing & platform URLs FAQ

Last updated 3 years ago

Was this helpful?

Clear Session

Often, at the end of a flow, an API backend call will be configured to, for example, save a train ticket in the ticket ordering system. Afterwards users should be able to book a new ticket to a different location.

You can achieve this with the 'clear session' action. This action removes the values of set session variables. This is useful when a user asks to correct a value, or to start over and delete all variables.

Send to offload provider

A user that reaches this action will be offloaded to a human customer support agent. For this to work, you need to enable offloading.

Depending on your selected offloading provider, additional configuration may be required.

API

Code

The code editor allows developers to quickly build custom logic on top of the bot by writing their own Javascript code blocks. Typically, the code editor is used to perform requests to external systems, or to do operations with variables.

There are also two tutorials in which we show you how the code editor can be used:

iframe

Have a look at this basic example:

<!DOCTYPE html><html lang="en">	<head>		<meta charset="UTF-8">		</head>		<body>			<button onClick="window.parent.postMessage(JSON.stringify({target:'CL_API',type:'SEND_MESSAGE', payload:{text: 'You clicked the button'} }),'*')">         SEND_MESSAGE        </button>		</body></html>

If this block of code is hosted and embedded within our iframe plugin, it will send the user a chat message when they click the button.

The postMessage API can also handle UPDATE_SESSION and GO_TO_DIALOGSTATE events.

JSON Builder

Website window events

You can use the JSON builder action in combination with the webwidget channel to receive window events on your webpage. These events will contain the data as configured in your JSON builder action.

Here's an example: Configure your JSON builder action to send a language key, with a variable retrieved from the session, and the "Send config to parent window" toggled on.

Your widget will trigger an event for that configuration to its parent window as a MessageEvent. The MessageEvent will contain a `data` field which contains the stringified result of the JSON builder configuration. Here's an example on how to listen to these events:

// Chatlayer JSON Builder Event Handlerwindow.addEventListener('message', (event) => {    const data = event && event.data && JSON.parse(event.data) || {}    const { type, payload } = data    if (type !== 'CL_DISPATCH_EVENT') return;    console.log('Chatlayer language received: ' + payload.language)})

This action can be used to integrate back-end services into your bot. More details can be found in .

You can find more information about the code editor here:

An iframe is a custom element that can be used to show a different web page in the chat conversation. It can also be used to communicate with the parent window using the .

If your bot is published on the channel, you can use the JSON Builder action to send messages to the conversation that don't need to result in an actual message to the user. Typically, it's used to send information about the user or bot conversation to the website the bot is published on.

our tutorial
Code Editor/integrations/code-action
Retrieving data from Airtable (GET)/integrations/code-action/retrieving-data-from-airtable-get
Sending data to Airtable (POST)/integrations/code-action/airtable
postMessage API
Webhook API