Skip to content

Setting up WhatsApp webhooks for responses

Note

For general setup and configuration documentation for WhatsApp, see the WhatsApp with Apteco documentation.

The WhatsApp webhook process works as follows:

  • Meta sends WhatsApp events as JSON to the webhook.
  • Responses stream to your Webhooks table in the social database.
  • You then run the social response gatherer to pull data from the Webhooks table and place it in the SO_ response tables.

Create an Orbit Webhook Connector app in Meta

  1. Go to developers.facebook.com and sign in.
  2. Click My Apps, then click Create App.

    My Apps page on Facebook Developer portal

  3. Select Other, then click Next.

    Other option selected

  4. Select Business.

    Business option selected

  5. Name your app Orbit Webhook Connector and verify by logging in again.

    App details form with Orbit Webhook Connector name

You should now have the Orbit Webhook Connector shell.

Orbit Webhook Connector app shell

Get your app secret and set your privacy policy

You need an app secret to set up the webhook successfully.

App Secret field in app settings

Use this app secret as your AptecoOrbitSecret in the configuration below. This ensures you only receive events from this app.

Privacy Policy URL field

Configure the Orbit Responses API

Note

Make sure you have access to the OrbitResponses API—verify using Swagger.

Add the following configuration to your appsettings.json for the OrbitResponsesAPI:

JSON
"WhatsApp": {
  "ConnectionString": "user id=faststats_service;password=xxx;initial catalog=SO_Develop;data source=10.0.2.101;pooling=true;max pool size=10000;",
  "ConfiguredToken": "some-whatsapp-token",
  "AptecoOrbitSecret": "some-whatsapp-secret",
  "VerifyPayloadAfterRoundtripThroughJsonParser": true
}

Where:

  • ConnectionString—points to your social response database
  • ConfiguredToken—the token you wish to use when validating your webhook in Meta (e.g. 5ebfd954-6cba-4a36-aae7-385dd83fbeec)
  • AptecoOrbitSecret—your app secret from Meta

Get your webhook endpoint

Navigate to the Orbit Responses API Swagger page to find your endpoint.

WhatsApp webhook endpoints in Orbit Responses API

Request URL for WhatsApp webhook

Set up the webhook in Meta

  1. In your Orbit Webhook Connector app, choose to add Webhooks.

    Add your Webhook option in Meta Developer portal

  2. Click Subscribe to get to the verification page.

  3. Enter the webhook URL found in the previous step.

    Callback URL and verify token fields

    Note

    Enter the ConfiguredToken value (e.g. 5ebfd954-6cba-4a36-aae7-385dd83fbeec) as the Verify Token.

  4. Subscribe to the messages events.

    Subscription successful confirmation

  5. Make sure your connector is now live.

    Live connector status

You can now send WhatsApp messages and Apteco will store the messages and replies in your response database.