Covered in this article
Related pages
Latest Changelog
Version 1.1.0 ()
WhatsApp Component

WhatsApp Component

WhatsApp Component is designed to connect with WhatsApp

WhatsApp Component

Table of Contents

Description

WhatsApp Component is designed to connect with WhatsApp using Graph API The current release of component tested with API v18.0.

Credentials

Before building any integration flow please make sure you have prepared what WhatsApp requires for API communications:

To generate a System User access token after creating a system user:

  • Sign in the Meta Business Account.
  • Locate your business account in the top-left dropdown menu and click its Settings (gear) icon.
  • Click Business settings.
  • Navigate to User > System users.
  • Select the appropriate system user from the list of system users.
  • Click the Generate new token button.
  • Select the app that will use the token.
  • Select any permissions the app needs to function properly and generate the token.

  • Creating a token, you can choose between token expiration options - 60 days or Never expires. It’s on the user to refresh the token in the credentials if they choose to it to expire in 60 days.

Now you can create new credentials for the component:

  • Name Your Credential (string, required) - provide any name you wish
  • WhatsApp Business Account ID (string, required) - Follow https://developers.facebook.com/docs/graph-api/reference/whats-app-business-account/ to find the ID
  • System User Access Token (string, required) - Token generated above
  • API version (string, optional, v18.0 by default) - Version of API you are going to use, look at Facebook changelog to find out what changes have been made

If you plan to use the Webhook trigger, you may also need to complete the following fields:

  • App Secret (string, optional) - This is used for webhook verification. If left blank, the component will not verify incoming events. You can find this in the App Settings > Basic section.
  • Verify Token (string, optional) - This token is sent by Facebook as part of the callback URL verification. If left blank, the component will not verify it. This token is set up when you create the webhook in your application (Meta for Developers section)

Actions

Send Message

Simply send a message.

Configuration Fields

None

Input Metadata

Please refer to the Input Schema file for the full list of metadata fields. Input message fields depend on the type of the message (one of ‘contacts’, ‘location’, ‘text’, ‘template’). E.g. in case type: “template” is specified, you must ensure the template is properly prepared and verified according to the Meta’s requirements. Please refer to the official guides on how to accomplish it.

An example of the input message with the template available for testing purposes:

{
    "to": "+1234567890",
    "type": "template",
    "template": {
        "name": "hello_world",
        "language": {
            "code": "en_US"
        }
    }
}

Output Metadata

  • messaging_product - (string, required): For the WhatsApp API it will always be ‘whatsapp’.
  • contacts - (array, required): The input and wa_id of the messages.
  • messages - (array, optional): Messages status and ID.

Triggers

Webhook

This trigger is used to receive events from Facebook.

To utilize it, you need to manually create a webhook subscription in your Facebook application:

  1. Create a flow with the Webhook trigger as the first step. You might also need to add additional Credentials.
  2. Save and start this flow.
  3. Click the Run now button. There you will see the webhook URL, which will look like https://in.elastic.io/hook/6690dc400f98620012465ffd. Copy this URL.
  4. Sign in to Meta for Developers.
  5. Open your app.
  6. In the left menu bar, you will find the Webhooks section. Open it.
  7. From the dropdown menu, select WhatsApp Business Account and click Subscribe to this object.
  8. Paste the Callback URL you obtained in the third step.
  9. Provide any string as the Verify token. This should match the component credentials Verify Token, then click Verify and save.
  10. On this page, you can test webhooks by sending test data.
  11. To receive actual data, you need to switch the App Mode to Live mode. For more information, visit this page.

Configuration Fields

None

Input Metadata

None

Output Metadata

Dynamically created event from facebook

Click here to learn more about the elastic.io iPaaS