How WhatsApp bot works - part 3

You may need to do some computations or other logic with the values that are stored in variables.
For example:
Collect and order details and sum up the cost of the order items.

Now, you have two choices in regards to where you want to do the computations.
1.)You can do them inside the bot’s flow
2.)You can do them outside of the bot’s flow

When you choose option 1, you have to use scripting functionality of the third party’s platform.
For examples, Twilio functions, or liquid.

When you choose option 2 , you send all of the values that are stored in the variables, as a JSON string, to some service (i.e. Integromat), do the computation there or use a Google Cloud Function.

Each number that sends a message to the bot, should be entered into a special data base.

The entry in the data base will keep the date and time of the incoming message.

Now, every time BEFORE a message will be sent via the third party’s API to a number in WhatsApp, the automation process will need to query the data base for the record of this number, and calculate how much time has passed since the last interaction with this number.

If 24 hours did NOT pass since the last interaction, you can send any message you want.

If 24 hours passed since the last interaction, a template message will have to be sent.

Scroll to Top