Use Torq workflows to automate your usage of WhatsApp Business, one of the products offered by Meta.
First, you need to create and configure an app in Meta for your WhatsApp Business account, and then you can create a WhatsApp Business integration in Torq to start using WhatsApp Business steps in workflows. You can also create a WhatsApp Business trigger integration in Torq to have workflows triggered by the WhatsApp communication.
Meta Configurations
Perform these steps in the Meta developer console.
Create a Meta Developer Account
Follow the instructions in the links below.
Create a Meta App and Set Up WhatsApp Business
Set up WhatsApp Business to automatically get a test phone number for your business. You can use this phone number to explore the WhatsApp Business platform without registering or migrating a real phone number. Test phone numbers can send unlimited messages to up to 5 recipients (which can be located anywhere in the world).
Use a Meta app to send WhatsApp Business test messages and get an access token to use in Torq.
Create a Meta App: Go to developers.facebook.com > My Apps > Create App.
Select Business.
Enter a meaningful Display name, for example, Torq.
Select a Business Account. If you don't have a business account, the onboarding process will automatically create one for you.
Click Create app.
In the Add Products to your app section, scroll down to locate the WhatsApp card and click on its Set up button.
Copy and save the Phone number ID. You'll need it to create the WhatsApp integration in Torq.
The Getting Started tab contains tools and information to help you send test messages. It can be used with test phone numbers and any numbers you register.
Configure the Meta App
Go to Settings > Basic.
Set the Privacy Policy URL: https://torq.io/privacy.
Set the Terms of Service URL: https://torq.io/terms-conditions.
Set the App icon (optional).
Copy the App ID to use in the next section.
Add the Meta App to a Business Account
Open Business Settings.
Go to Accounts > Apps.
Click the Add dropdown menu.
Select Connect an app ID.
Enter the Meta app ID.
Click Add App.
Add a System User to the Meta Business Account
Associate a system user (i.e., service account) with your WhatsApp application.
Create a System User
Go to Business Settings.
Got to Users > System users.
Click Add.
Give the system user a significant name, for example, torq-user.
Set the System user role to Admin.
Click Create system user.
Assign Assets to the System User
Give the system user full control of your Meta app.
Click Add Assets.
Select to assign the Apps asset type.
Select your Meta app from the list of assets.
Enable the Manage App toggle.
Click Save Changes.
Generate an Access Token
Click Generate new token.
Select your Meta app.
Assign the Meta app the following permissions from the Available Permissions list:
whatsapp_business_messaging
whatsapp_business_management
Click Generate token.
Copy and save the Access token. You'll use it to create the WhatsApp integration in Torq.
Set up WhatsApp Message Templates
Business-initiated conversations must start with a pre-approved template. Any other message type supported (text, multimedia, contacts, location, etc) can only be sent to a user after a user-initiated message is sent to the WhatsApp bot and only for the subsequent 24-hour period.
Once the 24-hour period expires, the next message sent is considered a business-initiated message, and, again, it must use a pre-approved template.
Create and edit WhatsApp message templates
Click the hamburger menu at the top of the left pane.
Select the WhatsApp Manager.
Select Account Tools > Message Templates.
Use the Create Message Template button to create a new template or use one of the existing templates.
Use WhatsApp Business steps in Torq workflows
Make sure you perform all the configurations required in Meta first.
Create a WhatsApp Steps Integration in Torq
Go to Build > Integrations > Steps > Whatsapp, and click Add.
Give the integration a meaningful name.
Enter the Meta app access token you copied in a previous step.
Enter the phone number ID you copied in a previous step.
Example Torq workflow: WhatsApp steps
This section illustrates how to use the WhatsApp steps in a workflow.
You can use the Send Template Message step for business-initiated conversations.
For the Send Text Message step to work, a user-initiated message must have been sent to the WhatsApp bot over the previous 24 hours. Otherwise, you're sending a business-initiated message for which you can only use the Send Template Message step.
Read this for more information on the difference between business-initiated and user-initiated conversations.
Use WhatsApp Business events to trigger Torq workflows
Create a WhatsApp Business Cloud trigger integration to get events for messages sent via the WhatsApp Cloud API and user interactions with these messages to complete your WhatsApp-based ChatOps experience.
To trigger workflows with WhatsApp Business events, you need to create a WhatsApp Business Cloud integration in Torq and provide the associated webhook to your app in Meta.
Create a WhatsApp Business Cloud trigger integration in Torq
Go to Build > Integrations > Triggers > WhatsApp Business Cloud and click Add.
Give the integration a unique and meaningful name.
Add authentication headers as required. While this step is optional, it's recommended for security purposes.
Click Add to create the integration.
Locate the integration and copy the webhook (URL link).
Configure the Webhook in the Meta App
Go to developers.facebook.com > My Apps.
Select the app you want to configure.
Open the WhatsApp dropdown menu.
Click Configuration.
In the Webhook section, click on Edit.
Provide the URL of the trigger integration you created in the previous section as the Callback URL.
Enter any alphanumeric string in the Verify Token field.
Click Verify and save.
In the Webhook fields section, click Manage and subscribe to get events for messages.
Trigger Events
Use the WhatsApp Business steps integration in other workflows to send WhatsApp messages for business-initiated conversations. Below is a list of the events the WhatsApp Business trigger integration can get.
Message delivery status
Message sent: A message was sent by the business.
Message delivered: A message sent by the business was received by the user's device and is ready for the user to view.
Message read: The recipient has read the message that was sent by the business.
User Interactions. An example of an interaction you will get a notification for is the user clicking on a button in a business-initiated message.
Messages sent by the user: Direct messages sent by the user to the business.