If you are looking for how to send a quick reply button template on WhatsApp using WhatsApp by Gupshup, this article can help you in implementation.
What you'll need:
Skill level: Intermediate
Time required: 5 minutes
- Sandbox or live account in WhatsApp by Gupshup
- A quick reply button template
- An app in WhatsApp by Gupshup running in your WhatsApp
Selecting the button template
- Log in to your WhatsApp by GupShup account. Then select the app to connect with Quickwork and use its quick reply template e.g., kayoapp1 as shown in the screenshot:
- In the Advanced Settings page of the app, scroll down to the Template Messaging section. Then, enable the toggle button:
Note: It is mandatory to toggle ON the Template Messaging button else the journey won't send the template message to a user on WhatsApp. - Then scroll down to the Test access API and set callback URL section and click the View templates button:
- This will take you to the Template List window in the new tab. This window contains a list of all templates that can be sent on WhatsApp:
- Here, we will be choosing the account_statement button template that will allow the user to view the account balance and a mini statement in WhatsApp. It contains one parameter marked as {{1}} and two quick reply buttons View Account Balance and View Mini Statement.
Note: The above template is of the sandbox account kayoapp1. So, the predefined content of the template is uneditable. The details can be changed only if the template belongs to the live account. Click here to understand the elements of a template and know how to apply for a custom template in the live app.
Configuring the first journey
The first journey sends the quick reply buttons as a message on WhatsApp tapping which the user gets the desired result.
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 kayoapp1 app. Click here to know how to connect a Gupshup app with Quickwork.
- 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:
- Type a text in the Message field and select No in the Send welcome message field:
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 template message action.
- The connection is established automatically with kayoapp1.
- In the Phone number field, enter the WhatsApp number of the person you want to send the button template.
- In the Template type field, select Text.
- In the Template ID field, select account_statement (en_US).
- Now move to the Params object. Under the Item 1 block, enter the account number, e.g., xxxx3228 in the Parameter field. We, hereby, defined the parameter value:
- The first configured journey looks like below. Save the changes and click the Save & Start button:
Configuring the second journey
The second journey contains logic for each quick reply button. Whenever any quick reply button is tapped, the journey checks for the button name and then sends the appropriate result on WhatsApp.
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 Template Quickreply click from the drop-down menu in the Triggers field.
- Connect the same kayoapp1 in this journey.
Configuring the action under IF Else block
Since there are two buttons in the template, i.e., View Account Balance and View Mini Statement, let's use If Else Condition and configure the logic to be executed for each button, respectively. In case of more quick reply buttons, you can use the If Condition multiple times.
- In the Steps section, click on the Business Logic button and choose the If Else Condition block.
- The If and Else blocks will appear with their respective indented simple actions. Click the If block. In the Left Value field, drag and drop the Text data pill present in the Payload object under the WhatsApp by Gupshup | Template Quickreply click Trigger data tree.
- Select Equals in the Condition field.
- Enter the button name, i.e., View Account Balance in the Right Value field.
Note: Ensure to keep the exact name of the quick reply button in the Right Value field, else the If Else block won't be able to compare and process and the configured actions down the line. - Now, click the Please choose an action bar below the If block. Choose WhatsApp by Gupshup in the App drop-down menu.
- Select Send message as an action. The connection gets established automatically with kayoapp1.
- In the Message field, enter the message to be sent upon clicking the View Account Balance button.
- In the Phone number field, pass the Sender Id data pill from the WhatsApp by Gupshup | Template Quickreply click Trigger data tree:
- Now let's move towards configuring the action under the Else block for creating a logic when the user clicks the View Mini Statement button. Clicking the button must send a PDF file of the account statement in WhatsApp.
- Click the Please choose an action bar below the Else block. Choose WhatsApp by Gupshup in the App drop-down menu.
- Select Send media as an action. The connection gets established automatically with kayoapp1.
- In the Phone number field, pass the Sender Id data pill from the WhatsApp by Gupshup | Template Quickreply click Trigger data tree.
- In the URL field, specify the URL of a file you want to send. E.g., https://www.buildquickbots.com/whatsapp/media/sample/jpg/sample01.jpg.
Note: Since this template belongs to the sandbox app kayoapp1, Gupshup allows sending a dummy media file that they support. To send personalized files on WhatsApp, use a customized template of a live app. - In the Message field, enter the message to be sent upon clicking the View Mini Statement button.
- Set Media type to File:
- Now save the changes and click the Save & Start button. The fully configured second journey looks like this:
Activating the app on WhatsApp
Go to your WhatsApp by Gupshup account, click the kayoapp1, 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. Paste it in the new tab to open it:
Paste it in the new tab to open it. The web version of WhatsApp will open with the predefined command PROXY kayoapp1 in the text field. Click the CONTINUE TO CHAT button:
If you are haven't linked the web version of WhatsApp, you'll be asked to do so. Send the command PROXY kayoapp1 to the WhatsApp by Gupshup chat account. You'll receive the welcome message confirming that the app is now connected successfully:
Executing the journey
Now, your app is activated and both the journeys are in the execution state. Refer to the following GIF to understand the working of quick reply template buttons:
Comments
0 comments
Please sign in to leave a comment.