Skip to content

Webhooks

Introduction

  • Waba Notifications may be received by Client (web) application (in public domain) by subscribing to Webhooks. Configuring ‘Webhook Url’ in ‘Waba Settings’ Page in user login as shown in below screenshot will enable Waba Notifications to client application.

alt text

  • Incoming messages, if webhook url given, and Message Status updates, if ‘Post Status Notifications’ selected, will be posted (Mthod: POST) to ‘Webhook url’ (Http EndPoint) with query parameters ‘notificationtype’ and ‘secsha’ and client’s end point should respond with Http StatusCode 200. In case client endpoint fails to handle

  • The http endpoint for webhook must allow anonymous access without any authentication. Use ‘Webhook Secret’ to provide better security or say authentication to this endpoint.

  • notificationtype’ - will have value:

  • inmsg’ - for Incoming Message – refer to Model for Json Body
  • status’ - for Message Status Update – refer to Model for Json Body.

  • In case client is interested only in Incoming messages and not interested in Status Notifications viz. Delivered, Read, etc then checkbox ‘Post Status Notifications’ should be kept unchecked to minimize needless traffic and data flow.

  • ‘Webhook Secret’ if set, Sha256 of the secret will be passed as ‘secsha’ parameter to Webhook end point. Receiving application will also store the original webhook secret and would compare Sha256 of the original webhook secret with the received Sha256 to provide better security.

Client Webhook Models

InStatusClientWebhook Model

1
2
3
4
5
6
7
8
9
    public class InStatusClientWebhook
    {
        public string status { get; set; }
        public ulong phone_no_id { get; set; }
        public string wamid { get; set; }
        public string recipient_id { get; set; }
        public DateTime status_date_time { get; set; }
        public string? errors_json { get; set; }
    }

InStatusClientWebhook Model

    public class InMsgClientWebhook
    {
        public string type { get; set; }
        public ulong phone_no_id { get; set; }
        public string from { get; set; }
        public string wamid { get; set; }
        public DateTime? msg_date_time { get; set; }
        public InMsgTextMessageBody text { get; set; }
        public string media_id { get; set; }
        public string media_url { get; set; }
        public string? media_size { get; set; }
        public string? reaction_to_wamid { get; set; }

        public class InMsgTextMessageBody
        {
            public string body { get; set; }

        }
    }