Create a Sample App Endpoint for Webhooks Testing

Use Glitch to create a sample app with an endpoint to test your webhooks. Glitch will provide a public URL served over HTTPS for your webhook.

Cloud API Sample App Endpoint

Follow these steps to generate a test Webhooks endpoint for the Cloud API:

  1. Go to our starter webhook project on Glitch: Remix on Glitch
  2. At this point, we recommend that you either Log in or Sign up for Glitch. Only logged in users see all the options described below. Once you're ready, click the Remix Your Own button in the bottom right. A copy of the project will be created for you.
  3. In the app.js file, update the value of the VERIFY_TOKEN to a random string of your choosing.
    const VERIFY_TOKEN = "hello";
  4. Click Share at the top right to get the Live site URL. Add /webhook at the end of the URL to get your complete callback URL. It will look something like https://<project-name.glitch.me/webhook.
  5. Add the URL and Verify token to the Webhooks > Edit Subscription in the Meta App Dashboard.
  6. Click Test to send a test notification to your endpoint.

On-Premises API Sample App Endpoint

  1. Go to our starter webhook project on Glitch: Remix on Glitch
  2. Click server.js in the left navigation to for the Webhook endpoint implementation.
  3. Click Share at the top right to get the Live site URL will will be your callback ULR. It will look something like https://<project-name.glitch.me/webhook.
  4. Click on the Status button in the left navigation pane. You will see that your app is listening on a specific port.
  5. Send a message or send yourself a test message to see the notification. The following example of the log shows a received text message with a body of "Hi" and a sent message with updated status of sent, then delivered, then read.
    Incoming webhook: {"messages":[{"from":"1234567890","id":"ABGGhSkIc2B_Ago-sDy5BNm-1gI5","text":{"body":"Hi"},"timestamp":"1529381066","type":"text"}]}
    Incoming webhook: {"statuses":[{"id":"gBGGhSkIc2B_AgkXDygfSDwgG5s","recipient_id":"1234567890","status":"sent","timestamp":"1529381072"}]}
    Incoming webhook: {"statuses":[{"id":"gBGGhSkIc2B_AgkXDygfSDwgG5s","recipient_id":"1234567890","status":"delivered","timestamp":"1529381072"}]}
    Incoming webhook: {"statuses":[{"id":"gBGGhSkIc2B_AgkXDygfSDwgG5s","recipient_id":"1234567890","status":"read","timestamp":"1529381076"}]}