How to send Service Review Invitation and Product Review Invitations with WhatsApp for Business and API Links
If you're a Trustpilot business user looking to invite your customers via WhatsApp to review your service and products and invitation link, you can achieve this using the Trustpilot API and Twilio for WhatsApp for Business (WABA). This guide will walk you through the steps to set this up using Trustpilot's private API. For more information on getting started with Trustpilot's private API, be sure to refer to our guide. If you’re looking for a guide on how to set up SMS please refer to this guide.
Prerequisites
To start sending create service review and product review API links through WhatsApp for Business, you'll need the following:
Trustpilot business account - create one here
Trustpilot API links - Create a Service Review or Product Review invitation link to include in the body of your WhatsApp messages. Walkthrough here.
Twilio Account - Twilio account (sign up here for a free trial)
API client - optional (we would recommend Postman)
Programming environment - Familiarity with a programming language such as Python, Node.js, or Java is recommended for implementing the integration.
Key concepts:
To start using the WhatsApp Business Platform with Twilio, it is crucial to grasp the key concepts related to the highly-regulated nature of WhatsApp as a communication channel, that requires documentation and approval from Facebook.
One pivotal concept is the "24-hour session" enforced by WhatsApp. This timeframe begins when an end user initiates contact with your business through a WhatsApp message. Within this 24-hour window, commonly referred to as a "session," you are permitted to send free-form (non-templated) messages to the user. It's important to note that a WhatsApp session remains active for 24 hours after the receipt of the last inbound message from the user.
Outside of the 24-hour WhatsApp session, communication is restricted to messages adhering to pre-approved templates. Any message that deviates from these templates is categorised as a free-form message. Further details on this protocol and guidelines for using templated messages for WhatsApp notifications can be found in our comprehensive guide.
An essential requirement for notifications is the use of WhatsApp templates. Beyond the 24-hour session, your business is limited to sending messages following pre-approved templates to end users. Examples of such templated messages include:
"Your {{1}} has been delivered. Please leave us a review on Trustpilot {{2}}. If you have any questions, please reach out."
"Your appointment for {{1}} is {{2}}. Need to reschedule? Tap below to reply."
In the provided examples, {{1}} and {{2}} represent message-specific information tailored for individual end users. As you embark on the WhatsApp Business Platform with Twilio, the submission of templates for approval by WhatsApp is a vital step. Detailed information on the approval process and guidelines for sending messages with WhatsApp notification templates can be found in this guide.
Integration Steps:
Now, let's dive into the steps to include Trustpilot API links into WhatsApp for Business using Twilio. If you’ve not yet created your review invitation links you can follow this guide here.
Step 1: Register a Twilio Account
Setup your Twilio Account - If you haven’t already, sign in to your Twilio account and navigate to the Twilio Console.
Step 2: Buy a Twilio number
You’ll either need to use a phone number that you currently own or purchase a number from the Twilio console. You can navigate here from the sidebar within the console and select the tab Phone Numbers > Manage > Buy a number or Active Numbers. You will need a number with SMS capability in order to complete this guide. If you want to use a non-Twilio number, please refer to this article. Buy a number page
Step 3: Register your number
If your brand is not already using WhatsApp to communicate with your customers, you will need to onboard your brand onto the Twilio platform before you begin sending messages. You also need to ensure that you have secured the proper opt-in from users to send them marketing messages. Following opt-in best practices will provide a better end user experience while ensuring your business is able to deliver messages as expected.
To start sending notifications to your customers, you will need a WhatsApp-enabled phone number, also referred to as a WhatsApp Sender. To get started, head over to the Messaging section of the Twilio Console and navigate to Senders > WhatsApp senders on the side menu. Once there, you'll see one of the following options to begin the sign up process:
Select a phone number to register: By default, you'll have access to the Self Sign-up process. This is a fully self-service process to register an existing Twilio phone number or bring your own number (BYON).
- Submit your first WhatsApp Sender: If you are an ISV, SI or if you registered for WhatsApp prior to 2022, you will use the Guided Signup process to "Submit a WhatsApp Sender".
Step 4: Set up WhatsApp message templates in your Twilio account
Once you have your WhatsApp sender, to create a WhatsApp template, go to Twilio Console > Messaging > Senders > Content Template Builder. You may send your Trustpilot API links in a template either in plain text or using a Call to Action button, e.g. “Thanks for signing up with My Business. To leave us a Trustpilot review click on https://www.trustpilot.com/evaluate-link/97879118c292e421ea05908f3d3d6f7d”.
Content template options
Configure your content and include a button that includes your API link as a variable
Once you have saved the template it will be sent to Meta for approval. WhatsApp will approve or reject template submissions in 48 hours or less.
Step 5: Obtain Twilio SID and Auth Token
Retrieve your Twilio Account SID and Auth Token from the Twilio Console. These will be used to authenticate your requests to the Twilio API.
Step 6: Write a Script to Send WhatsApp Messages with API Links
Once you have an approved WhatsApp Sender and your Trustpilot API invitation links continue on to Twilio for their Programmable Messaging Quickstart in the language of your choice. To send a templated message, include the full body of the message in the API call. Twilio will send the message as a templated message if it matches one of the approved templates. If the body does not match a pre-registered template, the message will be sent as a freeform message. This means it may not deliver if it is outside a 24-hour session. For further details on sending WhatsApp message templates see this guide.
Here is an example using Node.js and Express.js web framework:
// Download the helper library from https://www.twilio.com/docs/node/install
// Find your Account SID and Auth Token at twilio.com/console
// and set the environment variables. See http://twil.io/secure
const accountSid = process.env.TWILIO_ACCOUNT_SID;
const authToken = process.env.TWILIO_AUTH_TOKEN;
const client = require('twilio')(accountSid, authToken); client.messages
.create({
//Your WhatsApp enabled sender
from: 'whatsapp:+14155238886',
//Replace with your Trustpilot link
body: `Your Harrison Cords order has been collected . Please leave us a review. https://www.trustpilot.com/evaluate-link/97879118c292e421ea05908f3d3d6f7d`,
//Replace with your WhatsApp user
to: 'whatsapp:+YOUR_WHATSAPP_NUMBER'
})
.then(message => console.log(message.sid));
- Replace the placeholder values with your actual Twilio credentials and the recipient's phone number.
Step 6: Execute and Test
Run your script to send a WhatsApp message containing the API link. Verify that the message is delivered successfully to the recipient.
Step 7: Launch Your WhatsApp Business Presence
Once testing is successful, launch your integration with confidence. Start engaging with customers through WhatsApp and leverage its features to improve your Trustpilot invitation strategy.
Optional: How to detect if WhatsApp is installed on a device
One way to improve user experience is to default to WhatsApp instead of SMS when it's available. You can check if the app is installed on the same device you're running on. Follow the instructions for iOS and Android to determine if a package is installed. Here's an example WhatsApp detection implementation for Android:
Kotlin
fun PackageManager.isPackageInstalled(packageName: String): Boolean {
return try {
getPackageInfo(packageName, PackageManager.GET_ACTIVITIES)
true
} catch (e: NameNotFoundException) {
false
}
}
fun isWhatsAppInstalled : Boolean() {
val whatsAppPackageName = "com.whatsapp" val whatsAppBusinessPackageName = "com.whatsapp.w4b" return getPackageManager().isPackageInstalled(whatsAppPackageName) || getPackageManager().isPackageInstalled(whatsAppBusinessPackageName)
}
Unfortunately not every user has a WhatsApp account. While you can detect whether the WhatsApp application is installed on mobile, WhatsApp does not have an API to determine if an account exists prior to sending a message. Fortunately, WhatsApp does not charge for failed message attempts to accounts that don't exist while SMS does charge carrier fees for undelivered messages.
In conclusion, using WhatsApp to collect Trustpilot reviews offers a user-friendly and versatile approach, leveraging the popularity and features of the messaging platform to enhance the overall customer review experience. If you liked this community blog be sure to check out our other ones on the community home page.
References:
The WhatsApp Business Platform with Twilio
Getting started with WhatsApp
Sending Notifications with WhatsApp
Send WhatsApp Notification Messages with Templates
Using Buttons in WhatsApp
API Product Review: Generated Link Experience - Standard Flow
API Product Review: Non-Standard Collection Flow - Product Review Positioned First (Before Service Review)
The WhatsApp Business Platform with Twilio: Best Practices and FAQs
Message Template Approvals & Statuses
0 comments
Sort by