Getting Started

To integrate WhatsApp Business with Novu, You will have to create a facebook developer app and obtain the necessary credentials.

Step 1: Create a Facebook Developer App

Visit the Facebook Developer Portal and create a new app.

Select “Other” for “What do you want your app to do?” and select “Business” for “Select an app type”.

Step 2: Setup WhatsApp Product

On the App Setup page, click on “Set Up” under the “WhatsApp” product. You will need to create or add a Facebook Business Account to your app.

Step 3: Send a Sandbox Message

Copy the following pieces and paste them in the Novu WhatsApp Business integration settings:

  • Temporary Access Token - Access API token Field
  • Phone Number ID - Phone Number Identification Field

It’s important to note that the test credentials for whatsapp cannot be used in production and will expire in 24 hours. You will need to submit your app for review to obtain production credentials.

Step 4: Add a Test Phone Number

You can add a test phone number to the sandbox by clicking on the “Add Phone Number” button. This number can be used to test your integration with Novu before submitting for a review.

Step 5: Send a test notification from Novu

You can now create a new Workflow with a “Chat” node, and add your content. Save your workflow, and click on “Trigger Notification” Button.

In the to field, specify the phone number you added in the sandbox, and click on “Send Notification”.

{
  "subscriberId": "TEST_SUBSCRIBER_ID",
  "phone": "+11111111111"
}

and in the overrides field, add the following:

{
  "chat": {
    "template": {
      "name": "hello_world",
      "language": {
        "code": "en_US"
      }
    }
  }
}

For test credentials you can only used the built in Whats App Template.

Going to Production

Register a Business Phone Number

To go live you will need to add a real business phone number and submit your app for review. Follow the Facebook Instructions on how to proceed.

Generate a permanent access token

Follow the Facebook Instructions on how to generate a permanent access token. Depending on your use case.

Create a WhatsApp Template

You will need to create a WhatsApp Template to send notifications to your customers. Create a template in the Business Manager and submit it for review. After your template is approved, you can use the template_name to send notifications to your customers.

To send a notification with a template, you will need to add the following to the overrides field:

novu.trigger("workflow-id", {
  to: {
    subscriberId: "SUBSCRIBER_ID",
    phone: "+11111111111",
  },
  payload: {},
  overrides: {
    chat: {
      template: {
        name: "template_name",
        language: {
          code: "en_US",
        },
      },
    },
  },
});