Integrating API with Chatbot

You can integrate Chatbot end to end with your Business and/or external CRM systems. To achieve this, you need to access relevant APIs from Chatbot.

What is a Trigger?

A trigger is a REST API call from the Chatbot. You can pass information received in Chatbot to API and depending on the response, you can control the further conversation.

How to add a New Trigger?

AmplifyReach Dashboard → Click on Build Bot → Bot Studio → Select on Triggers → Click on Add New Trigger

Adding Trigger Details

  1. Trigger Name –  Name of the trigger to refer to in conversation.
  2. Trigger Description – Short description of trigger
  3. Method Type – GET/POST/PUT etc.
  4. Response Type – JSON/XML
  5. API/ Service URL – API Endpoint
  6. Header – Add header(s) with key value
Tip: Trigger can be combined with intent, input parameters and message type nodes.
Tip: Trigger when getting consumed as part of the message type node, then the Bot Say’s becomes optional and you can actually create a Trigger only node.
Tip: Trigger can’t be combined with condition based nodes.

Setting Trigger Header

Setting Trigger Body

Add trigger body in case of POST/PUT methods. Note, the value of variables in Chatbot is accessed using {{variable_name}}. Same convention is used while passing values to the API.

Checking Trigger Response

Map API Response Keys to variables in the Response Keys tab. You need to map only those keys which you need to use in Chatbot. In the following example, status is mapped to LeadGenerationStatus variable.

Using Trigger in the conversation.

Once a trigger is created, you can use it in conversation.

  1. Open conversation, goto the message where you would like to call API.
  2. Select Use API Call(Trigger)
  3. Enter the Name given to the Trigger and it will appear as shown in the image above
  4. Click Save

Bot Say’s Message:

Add the relevant information that you would like to show the end user. The bot message is displayed first before the trigger is executed.

Tip: Trigger is always executed last in sequence. So if you are consuming triggers with Intent, then first the intent is identified, bot message is displayed and then the trigger is executed.
Tip: When combining trigger with input parameters, the bot message is displayed first, the user input is collected and then the trigger is called and executed

Message While Trigger API Calls

This allows you to define a message you can convey to the user while the trigger executes. This helps to inform the user about the process in progress and keeps him engaged.

Trigger execution

Trigger has input variables, these are typically consumed by GET parameters and body details. Trigger relies on conversation to provide appropriate information in those variables. Trigger also uses input variables for validation of the trigger response, if the user wants to do any validation. Trigger provides output variables, in which valuable information is stored like motor insurance premium that would be consumed by the conversation and displayed to the user to take some action on the same like purchase insurance.

Trigger Success and Failure

A Trigger is successfully when it meets the following criteria:

  • 200 OK HTTP Status code is received
  • Under Status tab, all the status key and value comparison has yielded TRUE
  • Under Validation tab, minimum number of validations are TRUE
  • All the keys mentioned in Response Keys are present in the response body

If any of this fails then the Trigger has failed and the conversation would be handed over to the manual agent, if handover to manual agent is enabled during deployment.

Using Advanced Objects in Trigger

The Chatbot can access complex objects as well as other structured elements. 


If there are two variables under Status json object





They can be accessed as

Output Key Mapping Key
status.errorCodeErrorCode (Generally this is passed by mother)

Please contact in case you need any assistance

Deleting Trigger

Please note, to delete a trigger, no conversation should be using it. It will show a list of conversations using a trigger.