Skill level: Intermediate
Time required: 10 minutes
This article explains how to use the Send list message action to send multiple options on WhatsApp using WhatsApp by Gupshup.
Prerequisites
- Sandbox or live account in WhatsApp by Gupshup
- A WhatsApp by Gupshup app running on your WhatsApp
- Two Quickwork journeys:
- To configure the list of language options.
- To set up responses for each selected list option.
Note: The Send list message action sends up to 10 options in a list.
Step-by-step guide
Create a new journey and name it as Send a list of messages. We will configure a trigger to listen to incoming messages and an action that sends a list of messages containing 5 language options.
1. Configuring the trigger
- In the Event section, choose the WhatsApp by Gupshup app from the drop-down menu in the Apps field present right below the New Trigger button.
- Select the trigger event as New text message from the drop-down menu in the Triggers field.
- Click the Link account button. Specify the API key and Source number of the app. For instance, the app named kayoapp1 is connected here. Click here to know how to connect a Gupshup app with Quickwork.
- Type a text in the Message field, and say hi. A webhook URL gets generated. Copy it, go back to kayoapp1 in your Gupshup account, and scroll down to Callback URL/Link your Bot. Paste the URL, toggle ON the button, and click Set.
- Select No in the Send welcome message field.
2. Configuring the action
- In the Steps section, click on the Simple Action button and choose the WhatsApp by Gupshup app from the drop-down menu in the Apps list.
- In the Actions list, select Send list message action.
- The connection is established automatically with kayoapp1.
- In the Destination field, enter the WhatsApp number of the person you want to send the list to. You can also drag and drop the Sender Id data pill from New text message Trigger in the Data Tree Output.
- In the Title field, enter the title of the list message. For example, Languages.
- In the Body field, enter the description of the list message. For example, Currently, there are 5 supported languages.
- Now let's configure Global Buttons. Although it is an array, only 1 global button can be configured with up to 10 options in it. Specify Type as text. Give a title as View here for the global button in the Title field.
- Now, let us define a few language options in an item. In the Title field, specify the heading of the options. For example, Language list.
- In the Subtitle field, specify the descriptions of the options. For example, Currently, there are 5 supported languages.
- In the Type field under the Item 1 object, specify the type of the option. By default, only text type is supported. In the Title field, enter the option to be displayed. For example, English.
- In the Postback Text field, enter the language option specified in the title field, for example, English. This text acts as an identifier for this specific list option and is used in the second journey as a validator to send an appropriate response on WhatsApp when this language option is selected.
- Now click the + Add New Item button to configure more language options.
- Refer to the following table for values to be spefied in the fields as per the procedure mentioned in Step 10, 11, and 12.
Input fields Values Item 2 Type text Title Hindi/ हिन्दी Postback Text Hindi/ हिन्दी Item 3 Type text Title Gujarati/ ગુજરાતી Postback Text Gujarati/ ગુજરાતી Item 4 Type text Title Marathi/ मराठी Postback Text Marathi/ मराठी Item 5 Type text Title Tamil/ தமிழ் Postback Text Tamil/ தமிழ் - The journey looks like the below after successful configuration.
- Save the journey changes and click the Save & Start button.
Configuring the second journey
Create a new journey and name it as Send appropriate response for list-option clicked. We will configure a trigger to record the user's action of clicking a language option. Then, a series of If conditions to configure the response for each language option. If the selected language option matches the Postback Text configured in the first journey, the response gets sent.
1. Configuring the trigger
- In the Event section, choose the WhatsApp by Gupshup app from the drop-down menu in the Apps field present right below the New Trigger button.
- Select the trigger event as Interactive quickreply click from the drop-down menu in the Triggers field.
- Click the Link account button. Specify the API key and Source number of the kayoapp1 app, the same app connected in the first journey.
Note: Connecting a different app won't execute this journey. -
Type a text in the Message field, and say hi. A webhook URL gets generated. No need to paste this webhook since it is the same static URL that we pasted while configuring the first journey.
2. Configuring a series of If conditions and actions within it
- Click the + icon, click the Business Logic button and select If Condition. If condition bar appears with an indented action.
- In the Left Value field, drag and drop the Postback text data pill from the WhatsApp by Gupshup | Interactive quickreply click Trigger under Data Tree Output.
- Select Equals as a Condition.
- Specify English as an input in the Right Value field.
- Now click the indented action bar beneath If condition. Select WhatsApp by Gupshup from the App drop-down menu. Select Send message from the Action drop-down menu.
- In the Message field, enter a message to be displayed on chat when the English option is selected. For example, Thank you for choosing English as your preferred language. How may I help you?
Enter "Hi" to view the language list again. - In the Phone number field, drag and drop the Sender Id data pill from the WhatsApp by Gupshup | Interactive quickreply click Trigger response under Data Tree Output.
- Upon execution, the If condition checks whether the character of the language option sent equals English or not. If yes, then its appropriate response gets sent.
-
Now, let us configure more If condition for other language options. Refer to the following table for values to be inserted in the input fields:
Business Logic/App Input fields Values If condition (2) Left Value Postback text
Condition Equals Right Value Hindi/ हिन्दी Send message-WhatsApp by Gupshup (2) Message हिन्दी को अपनी पसंदीदा भाषा के रूप में चुनने के लिए धन्यवाद। क्या मेरे द्वारा आपकी कोई सहायता हो सकती है?
भाषा सूची फिर से देखने के लिए "Hi" दर्ज करें।Phone number Sender Id
If condition (3) Left Value Postback text
Condition Equals Right Value Gujarati/ ગુજરાતી Send message-WhatsApp by Gupshup (3) Message ગુજરાતીને તમારી પસંદગીની ભાષા તરીકે પસંદ કરવા બદલ આભાર. હુ તમોને કેવી રીતે મદદ કરી શકુ?
ભાષા સૂચિ ફરીથી જોવા માટે "Hi" દાખલ કરો.Phone number Sender Id
If condition (4) Left Value Postback text
Condition Equals Right Value Marathi/ मराठी Send message-WhatsApp by Gupshup (4) Message तुमची पसंतीची भाषा म्हणून मराठी निवडल्याबद्दल धन्यवाद. मी आपली कश्याप्रकारे मदत करु शकतॊ?
भाषा सूची पुन्हा पाहण्यासाठी "Hi" प्रविष्ट करा.Phone number Sender Id
If condition (5) Left Value Postback text
Condition Equals Right Value Tamil/ தமிழ் Send message-WhatsApp by Gupshup (5) Message உங்களுக்கு விருப்பமான மொழியாக தமிழைத் தேர்ந்தெடுத்ததற்கு நன்றி. நான் உங்களுக்கு எப்படி உதவ முடியும்?
மொழி பட்டியலை மீண்டும் பார்க்க "Hi" ஐ உள்ளிடவும்.Phone number Sender Id
-
After successful configuration, the second journey looks like the below.
- Save the journey changes and click the Save & Start button.
Activating the app on WhatsApp
1.Go to your WhatsApp by Gupshup account, click the kayoapp1 settings, expand the Onboarding mechanisms section, and scroll down to the Smart mechanisms to get active and opted in users section. Go to the Click URL option and copy the URL.
2. Paste it into the new tab to open. The web version of WhatsApp will open with the pre-defined command PROXY kayoapp1 in the text field. Click the CONTINUE TO CHAT button.
3. Select the web version of WhatsApp and sign in. Send PROXY kayoapp1 as a message to WhatsApp by Gupshup. The app gets activated successfully.
Executing the journey
1. Send a message, say Hi. The Send list message action of the first journey executes and sends a list of options on the chat.
2. Click the View here button to view the options.
3. Select any one language of your choice and send it as a message. The If conditions configured in the second journey validates the character of the language option selected and then sends the message accordingly.
Comments
0 comments
Please sign in to leave a comment.