Trigger Event if User Abandons Chat Using AWS

Abby Updated by Abby

If a user abandons a chat there are several actions we can take to get them to re-engage.

Here we will use AWS Lambda to trigger a function, keep in mind that the following code is just an example of what you can do, and should be used as inspiration, rather than a guide, there are many possibilities

In this example, we use Airtable and AWS and will simply send them a new message, reminding them to continue the flow.

However, you could also assign them to a webhook block and create a ticket in Zendesk or Intercom

The Airtable:

The flow:

The flow in the bot is very simple

1. We'll first create a contact in Airtable with the customer ID

2. We'll then post the same customer ID to our AWS endpoint with a webhook

The body only needs to contain the following:

{"CustomerID" : "@id"}

3. At the end of the flow, we will use the customer ID as a reference and update the 'Completed' row to 'True'

The code:

In this example, I'm creating a function in AWS Lambda, you will just need to upload this ZIP to your own Lambda function and add your API keys

The information we sent to AWS in the webhook will be saved, and a 'Set Timeout' will be initiated once the information from the webhook is received

We can change the timeout (line 15) to up to 14 minutes, of course if you are doing this in your own server, you can set it to as much time as you need

AWS Lambda has a maximum time of 15 min to complete tasks, to set this to the max we will need to go to 'Configurations' in the function settings, select edit, and change the timeout

At the end of the 'Set timeout' the function will call the Airtable API and check if the variable completed is equal to 'True', if so the program will stop running

If the variable is not equal to true, it will trigger a message to the user, this part can be changed for whatever kind of functionality you would like to trigger

Keep in mind these are not native functionalities, therefore it is up to you to implement them yourself or with the help of your developer

How did we do?

Customized Behavior in Mobile Browsers

Launch Bot On Exit Intent