Skip to main content
WhatsApp Business

Automate WhatsApp Business comms with Torq: Set up Meta app, integrate with Torq workflow & triggers to streamline ChatOps.

Updated over 7 months ago

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.

  1. Create a Meta App: Go to developers.facebook.com > My Apps > Create App.

  2. Select Business.

  3. Enter a meaningful Display name, for example, Torq.

  4. Select a Business Account. If you don't have a business account, the onboarding process will automatically create one for you.

  5. Click Create app.

  6. In the Add Products to your app section, scroll down to locate the WhatsApp card and click on its Set up button.

  7. Copy and save the Phone number ID. You'll need it to create the WhatsApp integration in Torq.

  8. 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

  1. Go to Settings > Basic.

  2. Set the Privacy Policy URL: https://torq.io/privacy.

  3. Set the Terms of Service URL: https://torq.io/terms-conditions.

  4. Set the App icon (optional).

  5. Copy the App ID to use in the next section.

Add the Meta App to a Business Account

  1. Open Business Settings.

  2. Go to Accounts > Apps.

  3. Click the Add dropdown menu.

  4. Select Connect an app ID.

  5. Enter the Meta app ID.

  6. 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.

  1. Click Add Assets.

  2. Select to assign the Apps asset type.

  3. Select your Meta app from the list of assets.

  4. Enable the Manage App toggle.

  5. Click Save Changes.

Generate an Access Token

  1. Click Generate new token.

  2. Select your Meta app.

  3. Assign the Meta app the following permissions from the Available Permissions list:

    • whatsapp_business_messaging

    • whatsapp_business_management

  4. Click Generate token.

  5. 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

  1. Click the hamburger menu at the top of the left pane.

  2. Select the WhatsApp Manager.

  3. Select Account Tools > Message Templates.

  4. 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

  1. Go to Build > Integrations > Steps > Whatsapp, and click Add.

  2. Give the integration a meaningful name.

  3. Enter the Meta app access token you copied in a previous step.

  4. 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

  1. Go to Build > Integrations > Triggers > WhatsApp Business Cloud and click Add.

  2. Give the integration a unique and meaningful name.

  3. Add authentication headers as required. While this step is optional, it's recommended for security purposes.

  4. Click Add to create the integration.

  5. Locate the integration and copy the webhook (URL link).

Configure the Webhook in the Meta App

  1. Go to developers.facebook.com > My Apps.

  2. Select the app you want to configure.

  3. Open the WhatsApp dropdown menu.

  4. Click Configuration.

  5. In the Webhook section, click on Edit.

  6. Provide the URL of the trigger integration you created in the previous section as the Callback URL.

  7. Enter any alphanumeric string in the Verify Token field.

  8. Click Verify and save.

  9. 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.

Did this answer your question?