WA Webhook sample

After setting the webhook from Setting WA Webhook documentation, we will forward the WA webhook to your URL that has been set. There the examples from some WA webhooks.

Sample when WA receives a message.

{
    "app_code": "ramo-29lxxxxxxxxpsaio",
    "channel_id": 7xx,
    "contacts": [
        {
            "profile": {
                "name": "Andrianto Anggoro"
            },
            "wa_id": "6281xxxxxx80"
        }
    ],
    "messages": [
        {
            "from": "6281xxxxxx80",
            "id": "wamid.HBgMNjI4MTU3OTA5MDgwFQIAEhgWM0VCMDU4Njc4NzhFMUEzQzQxQUU1RAA=",
            "text": {
                "body": "Hi Qiscus"
            },
            "timestamp": "1694619169",
            "type": "text"
        }
    ],
    "messaging_product": "whatsapp",
    "metadata": {
        "display_phone_number": "6282xxxxxx902",
        "phone_number_id": "2614280515347021"
    }
}

Webhook sample when WA receives a media message.

{
  "app_code": "ramo-29lxxxxxxxxpsaio",
  "channel_id": 7xx,
  "contacts": [
    {
      "profile": {
        "name": "Andrianto Anggoro"
      },
      "wa_id": "6281xxxxxx80"
    }
  ],
  "messages": [
    {
      "from": "6281xxxxxx80",
      "id": "wamid.HBgMNjI4MTU3OTA5MDgwFQIAEhgWM0VCMDVCMTg1RTZDQTk4QkI2N0U5NgA=",
      "image": {
        "id": "1638370866648411",
        "mime_type": "image/jpeg",
        "sha256": "PLCSaS2RZQMy5gMvMOe41mto2xE4wSXmntSDIAau/kU="
      },
      "timestamp": "1694619570",
      "type": "image"
    }
  ],
  "messaging_product": "whatsapp",
  "metadata": {
    "display_phone_number": "6282xxxxxx902",
    "phone_number_id": "2614280515347021"
  }
}

Note: If you receive a media message, you can get the media attached using this API (Retrieve Media API)

Sample if the customer replies to the message bubble.

{
  "app_code": "bbhhf-cyjxxxxxxxcexl",
  "channel_id": 7xxx,
  "contacts": [
    {
      "profile": {
        "name": "Andrianto Anggoro"
      },
      "wa_id": "6281xxxxxx80"
    }
  ],
  "messages": [
    {
      "context": {
        "from": "62895346721980",
        "id": "wamid.HBgMNjI4MTU3OTA5MDgwFQIAERgSQTA4MERFNjlENzhFNDc4MTcwAA=="
      },
      "from": "6281xxxxxx80",
      "id": "wamid.HBgMNjI4MTU3OTA5MDgwFQIAEhgWM0VCMDg4ODAxMkZFN0JFNTVENDNBNQA=",
      "text": {
        "body": "Saya ingin bertanya terkait product Qiscus, apakah Anda dapat menghubungkan saya dengan Agent?"
      },
      "timestamp": "1759475898",
      "type": "text"
    }
  ],
  "messaging_product": "whatsapp",
  "metadata": {
    "display_phone_number": "628xxxxxxxx980",
    "phone_number_id": "830336960158571"
  }
}

Sample when the customer replies to the message with the Quick Reply button

{
  "app_code": "ramo-29lxxxxxxxxpsaio",
  "channel_id": 7xx,
  "contacts": [
    {
      "profile": {
        "name": "Andrianto Anggoro"
      },
      "wa_id": "6281xxxxxx80"
    }
  ],
  "messages": [
    {
      "button": {
        "payload": "payload-1",
        "text": "All Okay"
      },
      "context": {
        "from": "6282xxxxxx902",
        "id": "wamid.HBgMNjI4MTU3OTA5MDgwFQIAERgSODM5RkQ1RDE0QzFBMUVFOTZFAA=="
      },
      "from": "6281xxxxxx80",
      "id": "wamid.HBgMNjI4MTU3OTA5MDgwFQIAEhgWM0VCMEU4NUVCNjJDQjcwMjI0ODI2NQA=",
      "timestamp": "1694675589",
      "type": "button"
    }
  ],
  "messaging_product": "whatsapp",
  "metadata": {
    "display_phone_number": "6282241734902",
    "phone_number_id": "2614280515347021"
  }
}

Webhook sample when WA success sends a message

{
  "app_code": "ramo-29lxxxxxxxxpsaio",
  "channel_id": 7xx,
  "messaging_product": "whatsapp",
  "metadata": {
    "display_phone_number": "6282xxxxxx902",
    "phone_number_id": "2614280515347021"
  },
  "statuses": [
    {
      "conversation": {
        "id": "b1afb7b7d806c1c32fc190d5ff422331",
        "origin": {
          "type": "service"
        }
      },
      "id": "wamid.HBgMNjI4MTU3OTA5MDgwFQIAERgSOEU5RTRDQkE4RDBFNDU3RERBAA==",
      "pricing": {
        "billable": false,
        "category": "service",
        "pricing_model": "PMP",
        "type": "free_customer_service"
      },
      "recipient_id": "628xxx90xx8x",
      "status": "sent",
      "timestamp": "1759379167"
    }
  ]
}

Note: WhatsApp will send the webhook for every message (by id) if updated to delivered or read.

"status": "delivered",

or

"status": "read",

Webhook sample when WA failed sends a message

{
  "app_code": "ramo-29lxxxxxxxxpsaio",
  "channel_id": 7,
  "messaging_product": "whatsapp",
  "metadata": {
    "display_phone_number": "6282xxxxxx902",
    "phone_number_id": "2614280515347021"
  },
  "statuses": [
    {
      "errors": [
        {
          "code": 131026,
          "error_data": {
            "details": "Message Undeliverable."
          },
          "message": "Message undeliverable",
          "title": "Message undeliverable"
        }
      ],
      "id": "wamid.HBgMNjI4MTU3OTA5MDgwFQIAERgSQThGRjNENEJDN0M5OTg2NjkxAA==",
      "recipient_id": "6281xxxxxx80",
      "status": "failed",
      "timestamp": "1704520832"
    }
  ]
}

Note: The error code or the title may be different. You can check your error code here: Error Code

Webhook sample when the template is approved/rejected

{
  "app_code": "ramo-29lxxxxxxxxpsaio",
  "channel_id": 7xx,
  "event": "APPROVED",
  "message_template_id": 46xx175xxxxx132,
  "message_template_language": "id",
  "message_template_name": "testwebhook",
  "reason": "NONE"
}

Webhook sample when Meta recategorizes a template

{
  "app_code": "bbhhf-xasxxxxxxxxsdfas",
  "channel_id": 7xxx,
  "message_template_id": 62xx468xxxxx668,
  "message_template_language": "id",
  "message_template_name": "sample_template",
  "new_category": "UTILITY",
  "previous_category": "MARKETING"
}

Need further assistance?

Our helpful customer support team is available to help you with any inquiries you may have

Contact Us