Skip to navigation

Creating a workflow with Incoming message (Virtual Number)

This functionality is ideal for creating automated WhatsApp conversations using predefined templates and notification event triggers. It’s also useful for capturing and updating customer SMS responses in your system.

You can also capture Keypress values during a Voice call and trigger a workflow.

Example: COD order confirmation

For example, you can configure the below flow using our Workflow:

1Send a WhatsApp to customers who placed a COD order to either confirm or cancel their order.
2Based on customer’s response, update the status in your system by calling your API.
3Send order status update confirmation to the customer.
4Ask customer if they want to update their phone no.
5If yes, let them enter a phone no and call an API to update it in your system. If user selects No, the flow will end.

The animation below follows two customers through this flow, plus what happens if your API call fails.

To achieve this, you need to do the following:

Step 1: Create a WhatsApp template to initiate a conversation

1Create a template on the Templates page with the content and Quick Reply options as shown.
2

In the template, you can see 2 Quick Reply options. When user clicks any Quick Reply option, it will trigger a workflow.

  1. Confirm
  2. Cancel

Step 2: Design a Workflow to decide what WhatsApp message to send based on user response

Here is the trigger setup at a glance.

Set up the Virtual Number trigger

1

Select the trigger

Create a workflow and select VIRTUAL NO. from the triggers. The Mobile No. panel opens. To pick a different trigger, click CHANGE TRIGGER.

2

Select your WhatsApp Business number

Under Mobile Number, select the number to which users send their response. You can add more than 1 WhatsApp Business number, so any replies received on any of these numbers will trigger this workflow.

Don’t see your number? Click GO TO INTEGRATIONS to set up a new incoming number for WhatsApp, or contact support@fyno.io.

3

Store the button payload data (optional)

You can store the data you are passing in the button payload if you want to use that data further in the workflow. In this example, we are passing order_id and the template name in the button payload.

Expand Store Button Payload Data (optional), enter a name in Stored variable, and pick where the value comes from in Variable value from payload. Click ADD ANOTHER to store more values.

4

Simplify the payload (optional)

Incoming message payloads have long keys. Click SIMPLIFY PAYLOAD to open the Payload Mapper, where you can give a key a short name to use across the workflow.

Enter a name under MAPPER VARIABLES, then pick a payload key or enter HBS under PAYLOAD/HBS. Click ADD for more, then CONFIRM.

Check what the user replied

1

Add a condition for the reply

Add a condition to check what the user has sent to your WhatsApp Business number. In this use case, the user could have sent either ‘Confirm’ or ‘Cancel’. The variable simplified.message.button.text will contain the Quick Reply text your customer has sent. In this case, we have assumed the user has sent ‘Confirm’.

2

Check the template name (optional)

If you want to make sure this response comes from the exact template message you sent to the user, add one more condition to check the template name as shown.

Add the condition as Custom Value $input.body.entry.0.changes.0.value.messages.0.button.payload.template equals order_confirmation. This accesses the template variable we added in the WhatsApp template (see step 3 in Step 1).

3

Repeat for Cancel

Repeat the steps above for the ‘Cancel’ flow.

Update the order in your system

1

Call your API

Add the API action block to the workflow canvas to send the user response to your system and update the order status when the user clicks either ‘Confirm’ or ‘Cancel’.

You need to post a request to your webhook. Make sure you have allow-listed your URL. Read more about it here.

2

Check the update worked

Add a condition to check if the HTTP response code is 200, as shown below.

Notify the user and wait for their reply

1

Send the order status

If the HTTP status code is 200, send a notification to the user confirming the status of the order.

  • Map the mobile no in the destination section. You can choose simplified.source from the dropdown.
  • Map all the placeholders used in the template in the data section, in the format {{$http_response.data.<variable>}}.

Notification event settings

Click the settings icon at the top right of the Notification Event panel to open these tabs:

2

Wait for the user's reply

Add a Wait For Reply node to store the user response and use it further in the flow. You can also set how long to wait for the reply. In this example, we wait for 30 minutes and save whether the user wants to change their phone no.

3

Act on the reply

Using this, you can decide whether to call an API to update the phone no (if the user clicked Yes) or end the flow.

To send simple and interactive WhatsApp messages, you can directly use the Send Message node with a WhatsApp template. No need to create a notification event in such cases.

Nodes you can use

These nodes are available after a Virtual Number trigger:

NodeWhat it does
Notification EventSends a notification using one of your notification events.
APICalls an allowlisted API, for example to update your system.
SubscriptionUpdates the user’s notification subscription.
User ProfilesStores or updates details about the user.
Send MessageSends a WhatsApp message directly from a template, without a notification event.
Write to SpreadsheetWrites data from the workflow to a spreadsheet.
SubflowBundles repeated nodes so you can reuse them across the workflow.
AI Magic MatchSends the user down a branch based on the meaning of their reply.
ConditionSends the user down a branch based on a variable and a value.
Wait For ReplyWaits a set time for the user’s reply and stores it.

How to test an Incoming message workflow?

While configuring the trigger, expand Test Numbers (optional) and add up to 3 mobile numbers, with country codes. All messages sent from these numbers will trigger the latest Test version of the Workflow.

How to raise Approval requests

If your workspace has Approval turned on, clicking GO LIVE creates an approval request instead of publishing the workflow right away. You can read more about it on the Approval Request page.