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.
- Select Create app.
- In the ‘Add products to your app’ section, select Setup for WhatsApp.
- Once the validation has been made to your account, navigate back to the home page of the App
- From the side menu find the WhatsApp section and select API Setup.
- Select Generate access token and enter the value into the connection configuration of your integration.
- Additionally, this screen will also provide your accounts Test Number, Phone number ID, and Business Account ID.
Input | Notes |
---|---|
Input Access Token password / Required accessToken | Notes Your WhatsApp Access Token. |
Triggers
Webhook
Receive and validate webhook requests from WhatsApp Business for webhooks you configure. | key: webhook
Input | Notes | Example |
---|---|---|
Input App Secret password / Required appSecret | Notes The secret that WhatsApp will use to sign your webhook payloads. | Example 6a321a12a123456789abc54321f12a12 |
Input Verify Token string / Required verifyToken | Notes The token that WhatsApp will use to verify your webhook. | Example meatyhamhock |
Data Sources
Select Phone
Select a phone number. | key: selectPhone | type: picklist
Input | Notes | Example |
---|---|---|
Input Connection connection / Required connection | Notes | Example |
Input WhatsApp Business Account ID string / Required whatsappBusinessAccountId | Notes The ID of the WhatsApp Business Account to retrieve phone numbers for. | Example 12345678901234567 |
Actions
Delete Media
Delete a media file from a phone number. | key: deleteMedia
Input | Notes | Example |
---|---|---|
Input Connection connection / Required connection | Notes | Example |
Input Media ID string / Required mediaId | Notes The ID of the media file to delete. | Example 1234567890123456 |
{
"data": {
"success": true
}
}
Get Media
Get media from WhatsApp. | key: getMedia
Input | Notes | Example |
---|---|---|
Input Connection connection / Required connection | Notes | Example |
Input Media ID string / Required mediaId | Notes The ID of the media to retrieve. | Example 1234567890123456 |
Input Phone Number ID string phoneNumberId | Notes Business phone number ID. The operation will proceed only if it matches the ID used to upload the media. | Example 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
Input | Notes | Example |
---|---|---|
Input Connection connection / Required connection | Notes | Example |
Input URL string / Required url | Notes A URL returned by the Get Media action to download media from. | Example https://lookaside.fbsbx.com/whatsapp_business/attachments/?mid=12345... |
{
"data": "<BINARY_DATA>"
}
Raw Request
Send raw HTTP request to WhatsApp Business API. | key: rawRequest
Input | Default | Notes | Example |
---|---|---|---|
Input Connection connection / Required connection | Default | Notes | Example |
Input Data string data | Default | Notes The HTTP body payload to send to the URL. | Example {"exampleKey": "Example Data"} |
Input Debug Request boolean debugRequest | Default false | Notes Enabling this flag will log out the current request. | Example |
Input File Data string Key Value List fileData | Default | Notes File Data to be sent as a multipart form upload. | Example [{key: "example.txt", value: "My File Contents"}] |
Input File Data File Names string Key Value List fileDataFileNames | Default | Notes File names to apply to the file data inputs. Keys must match the file data keys above. | Example |
Input Form Data string Key Value List formData | Default | Notes The Form Data to be sent as a multipart form upload. | Example [{"key": "Example Key", "value": new Buffer("Hello World")}] |
Input Header string Key Value List headers | Default | Notes A list of headers to send with the request. | Example User-Agent: curl/7.64.1 |
Input Max Retry Count string maxRetries | Default 0 | Notes The maximum number of retries to attempt. Specify 0 for no retries. | Example |
Input Method string / Required method | Default | Notes The HTTP method to use. | Example |
Input Query Parameter string Key Value List queryParams | Default | Notes 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. | Example |
Input Response Type string / Required responseType | Default json | Notes The type of data you expect in the response. You can request json, text, or binary data. | Example |
Input Retry On All Errors boolean retryAllErrors | Default false | Notes 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. | Example |
Input Retry Delay (ms) string retryDelayMS | Default 0 | Notes The delay in milliseconds between retries. This is used when 'Use Exponential Backoff' is disabled. | Example |
Input Timeout string timeout | Default | Notes The maximum time that a client will await a response to its request | Example 2000 |
Input URL string / Required url | Default | Notes 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. | Example /106540352242922/messages |
Input Use Exponential Backoff boolean useExponentialBackoff | Default false | Notes Specifies whether to use a pre-defined exponential backoff strategy for retries. When enabled, 'Retry Delay (ms)' is ignored. | Example |
Register Phone Number
Register a phone number for use with WhatsApp. | key: registerPhoneNumber
Input | Notes | Example |
---|---|---|
Input Connection connection / Required connection | Notes | Example |
Input Data Localization Region string dataLocalizationRegion | Notes Enables local storage for the business phone number. Specify the country for data-at-rest storage. | Example IN |
Input Phone Number ID string / Required phoneNumberId | Notes The ID of the phone number to register. | Example 912345678912345 |
Input PIN string / Required pin | Notes Set this to your 6-digit two-step verification PIN if enabled. If not, set a new 6-digit PIN. | Example 123456 |
{
"data": {
"success": true
}
}
Request Verification Code
Send a verification code to verify a phone number. | key: requestVerificationCode
Input | Default | Notes | Example |
---|---|---|---|
Input Code Method string / Required codeMethod | Default | Notes The method to use to send the verification code. | Example SMS |
Input Connection connection / Required connection | Default | Notes | Example |
Input Language string / Required language | Default en | Notes The language's two-character language code code. | Example |
Input Phone Number ID to Verify string / Required phoneNumberId | Default | Notes The ID of the phone number to verify. | Example 912345678912345 |
{
"data": {
"success": true
}
}
Send Message
Send a message to a user. | key: sendMessage
Input | Default | Notes | Example |
---|---|---|---|
Input Audio code audio | Default | Notes A media object containing audio. Required when type is audio. | Example |
Input Biz Opaque Callback Data string bizOpaqueCallbackData | Default | Notes An arbitrary string, useful for tracking. Maximum 512 characters. | Example Some arbitrary string |
Input Connection connection / Required connection | Default | Notes | Example |
Input Contacts code contacts | Default | Notes A contacts object. Required when type is contacts. | Example |
Input Context code contextInput | Default | Notes An object containing the ID of a previous message you are replying to. Required if replying to any message in the conversation. | Example |
Input Document code document | Default | Notes A media object containing a document. Required when type is document. | Example |
Input Image code image | Default | Notes A media object containing an image. Required when type is image. | Example |
Input Interactive code interactive | Default | Notes An interactive object. Required when type is interactive. | Example |
Input Location code location | Default | Notes A location object. Required when type is location. | Example |
Input Phone Number ID string / Required phoneNumberId | Default | Notes Phone number ID of the WhatsApp Business Account you want to use to send the message. | Example 912345678912345 |
Input Preview URL boolean previewUrl | Default false | Notes Allows for URL previews in text messages. Required when type is text. | Example |
Input Reaction code reaction | Default | Notes A reaction object. Required when type is reaction. | Example |
Input Status string status | Default | Notes A message's status. You can use this field to mark a message as read. | Example read |
Input Sticker code sticker | Default | Notes A media object containing a sticker. Required when type is sticker. | Example |
Input Template code template | Default | Notes A template object. Required when type is template. | Example |
Input Text code text | Default | Notes A text object. Required when type is text. | Example |
Input To string / Required to | Default | Notes WhatsApp ID or phone number of the customer you want to send a message to. | Example 12124567890 |
Input Type string type | Default text | Notes The type of message you want to send. If omitted, defaults to text. | Example text |
{
"data": {
"messaging_product": "whatsapp",
"contacts": [
{
"input": "16505555555",
"wa_id": "16505555555"
}
],
"messages": [
{
"id": "wamid.HBgLMTY1MDUwNzY1MjAVAgARGBI5QTNDQTVCM0Q0Q0Q2RTY3RTcA"
}
]
}
}
Upload Media
Upload media to WhatsApp. | key: uploadMedia
Input | Notes | Example |
---|---|---|
Input Connection connection / Required connection | Notes | Example |
Input File data / Required file | Notes The file to upload. This should be a file returned from an action that returns a file. | Example |
Input Filename string filename | Notes The filename to use for the uploaded file. | Example example.jpg |
Input Phone Number ID string / Required phoneNumberId | Notes The ID of the phone number to upload media to. | Example 912345678912345 |
{
"data": {
"id": "<MEDIA_ID>"
}
}