Skip to main content

WhatsApp Component

WhatsApp is a messaging app that allows users to send texts, make voice and video calls, and share media.

Component key: whatsapp

Description

WhatsApp is a messaging app that allows users to send texts, make voice and video calls, and share media.

Use the component to send messages and configure webhook subscriptions.

API Documentation:

The component was built using the WhatsApp Business Platform Cloud API.

Connections

WhatsApp Access Token

To get started with WhatsApp, you first need to create a Meta developer account.

  1. Select Create app.
  2. In the ‘Add products to your app’ section, select Setup for WhatsApp.
  3. Once the validation has been made to your account, navigate back to the home page of the App
  4. From the side menu find the WhatsApp section and select API Setup.
  5. Select Generate access token and enter the value into the connection configuration of your integration.
  6. Additionally, this screen will also provide your accounts Test Number, Phone number ID, and Business Account ID.
InputNotesExample
Access Token

Your WhatsApp Access Token.

Triggers

Webhook

Receive and validate webhook requests from WhatsApp Business for webhooks you configure. | key: webhook

InputNotesExample
App Secret

The secret that WhatsApp will use to sign your webhook payloads.

6a321a12a123456789abc54321f12a12
Verify Token

The token that WhatsApp will use to verify your webhook.

meatyhamhock

Data Sources

Select Phone

Select a phone number. | key: selectPhone | type: picklist

InputNotesExample
Connection
WhatsApp Business Account ID

The ID of the WhatsApp Business Account to retrieve phone numbers for.

12345678901234567

Actions

Delete Media

Delete a media file from a phone number. | key: deleteMedia

InputNotesExample
Connection
Media ID

The ID of the media file to delete.

1234567890123456

{
"data": {
"success": true
}
}

Get Media

Get media from WhatsApp. | key: getMedia

InputNotesExample
Connection
Media ID

The ID of the media to retrieve.

1234567890123456
Phone Number ID

Business phone number ID. The operation will proceed only if it matches the ID used to upload the media.

912345678912345

{
"data": {
"messaging_product": "whatsapp",
"url": "<URL>",
"mime_type": "<MIME_TYPE>",
"sha256": "<HASH>",
"file_size": "<FILE_SIZE>",
"id": "<MEDIA_ID>"
}
}

Get Media from URL

Download media from a URL. | key: getMediafromURL

InputNotesExample
Connection
URL

A URL returned by the Get Media action to download media from.

https://lookaside.fbsbx.com/whatsapp_business/attachments/?mid=12345...

{
"data": "<BINARY_DATA>"
}

Raw Request

Send raw HTTP request to WhatsApp Business API. | key: rawRequest

InputNotesExample
Connection
Data

The HTTP body payload to send to the URL.

{"exampleKey": "Example Data"}
Debug Request

Enabling this flag will log out the current request.

false
File Data

File Data to be sent as a multipart form upload.

[{key: "example.txt", value: "My File Contents"}]
File Data File Names

File names to apply to the file data inputs. Keys must match the file data keys above.

Form Data

The Form Data to be sent as a multipart form upload.

[{"key": "Example Key", "value": new Buffer("Hello World")}]
Header

A list of headers to send with the request.

User-Agent: curl/7.64.1
Max Retry Count

The maximum number of retries to attempt. Specify 0 for no retries.

0
Method

The HTTP method to use.

Query Parameter

A list of query parameters to send with the request. This is the portion at the end of the URL similar to ?key1=value1&key2=value2.

Response Type

The type of data you expect in the response. You can request json, text, or binary data.

json
Retry On All Errors

If true, retries on all erroneous responses regardless of type. This is helpful when retrying after HTTP 429 or other 3xx or 4xx errors. Otherwise, only retries on HTTP 5xx and network errors.

false
Retry Delay (ms)

The delay in milliseconds between retries. This is used when 'Use Exponential Backoff' is disabled.

0
Timeout

The maximum time that a client will await a response to its request

2000
URL

Input the path only (/106540352242922/messages), The base URL is already included (https://graph.facebook.com/v21.0). For example, to connect to https://graph.facebook.com/v21.0/106540352242922/messages, only /106540352242922/messages is entered in this field.

/106540352242922/messages
Use Exponential Backoff

Specifies whether to use a pre-defined exponential backoff strategy for retries. When enabled, 'Retry Delay (ms)' is ignored.

false

Register Phone Number

Register a phone number for use with WhatsApp. | key: registerPhoneNumber

InputNotesExample
Connection
Data Localization Region

Enables local storage for the business phone number. Specify the country for data-at-rest storage.

IN
Phone Number ID

The ID of the phone number to register.

912345678912345
PIN

Set this to your 6-digit two-step verification PIN if enabled. If not, set a new 6-digit PIN.

123456

{
"data": {
"success": true
}
}

Request Verification Code

Send a verification code to verify a phone number. | key: requestVerificationCode

InputNotesExample
Code Method

The method to use to send the verification code.

SMS
Connection
Language

The language's two-character language code code.

en
Phone Number ID to Verify

The ID of the phone number to verify.

912345678912345

{
"data": {
"success": true
}
}

Send Message

Send a message to a user. | key: sendMessage

InputNotesExample
Audio

A media object containing audio. Required when type is audio.

Biz Opaque Callback Data

An arbitrary string, useful for tracking. Maximum 512 characters.

Some arbitrary string
Connection
Contacts

A contacts object. Required when type is contacts.

Context

An object containing the ID of a previous message you are replying to. Required if replying to any message in the conversation.

Document

A media object containing a document. Required when type is document.

Image

A media object containing an image. Required when type is image.

Interactive

An interactive object. Required when type is interactive.

Location

A location object. Required when type is location.

Phone Number ID

Phone number ID of the WhatsApp Business Account you want to use to send the message.

912345678912345
Preview URL

Allows for URL previews in text messages. Required when type is text.

false
Reaction

A reaction object. Required when type is reaction.

Status

A message's status. You can use this field to mark a message as read.

read
Sticker

A media object containing a sticker. Required when type is sticker.

Template

A template object. Required when type is template.

Text

A text object. Required when type is text.

To

WhatsApp ID or phone number of the customer you want to send a message to.

12124567890
Type

The type of message you want to send. If omitted, defaults to text.

text

{
"data": {
"messaging_product": "whatsapp",
"contacts": [
{
"input": "16505555555",
"wa_id": "16505555555"
}
],
"messages": [
{
"id": "wamid.HBgLMTY1MDUwNzY1MjAVAgARGBI5QTNDQTVCM0Q0Q0Q2RTY3RTcA"
}
]
}
}

Upload Media

Upload media to WhatsApp. | key: uploadMedia

InputNotesExample
Connection
File

The file to upload. This should be a file returned from an action that returns a file.

Filename

The filename to use for the uploaded file.

example.jpg
Phone Number ID

The ID of the phone number to upload media to.

912345678912345

{
"data": {
"id": "<MEDIA_ID>"
}
}