ANT
  • Introduction
    • Authentication
    • Number
    • Errors
    • Rate Limits
  • ANT API
    • Balance
      • Retrieve balance
    • Sms
      • Marketing SMS
        • Send Marketing SMS
        • Send Bulk Marketing SMS
        • Scheduled Marketing SMS
        • Marketing SMS CallBack
      • 🔥OTP SMS
        • Send OTP SMS
        • OTP SMS CallBack
        • ⭐OTP Backfill Interface
      • Notification SMS
        • Send Notification SMS
        • Send Bulk Notification SMS
        • Scheduled Notification SMS
        • Notification SMS CallBack
    • Voip
      • IVR
        • IVR File Upload
        • IVR Task
        • IVR Callback
      • Call
        • Call the phone
        • Call record callback
    • Phone Number Validation
      • HLR Sever
      • Check Number Status
  • Webhooks
    • Test Webhooks
  • Demo
    • Java Demo
Powered by GitBook
On this page
  • What are webhooks
  • Steps to receive webhooks
  1. Webhooks

Test Webhooks

What are webhooks

Webhooks are user-defined HTTP callback that notifies you about any action that has taken place.

Ant uses webhooks to push real-time notifications to your applications. By configuring webhooks, you can receive event notifications and use these notifications to execute actions in your backend systems.

Steps to receive webhooks

You can start receiving event notifications in your applications using the steps in this section:

  1. Create a webhook endpoint.

  2. Send your URL to your customer service

  3. Handle requests from ANT by parsing each event and returning 2xx response status codes.

Step 1: Create a webhook endpoint

You can build your webhook with code. Here is an example of Java code:

@GetMapping("/ant-sms-deliver")
 public ResponseEntity<Object> listenAnt(@RequestParam(name = "smsId") String msgId,
                                            @RequestParam(name = "destination") String destination,
                                            @RequestParam(name = "sendTime") String sendTime,
                                            @RequestParam(name = "sendResult") String sendResult,
                                            @RequestParam(name = "dr") String dr,
                                            @RequestParam(name = "smsCount") String smsCount) {
        try {
            //todo your code
        }catch (Exception e){
            ILogger.info("listenAnt err ", e);
        }

        return new ResponseEntity<>(org.springframework.http.HttpStatus.OK);
}

Step 2: Send your URL to ANT

https://your-server/ant-sms-deliver

Step 3: Handle requests from ANT

Check event objects

Each event is structured as an event object with common properties: smsId,destination,sendTime, sendResultand smsCount

Your webhook?
smsId=d3b0axxxxx070fb4dce8
&sendTime=1734509284831
&sendResult=SUCCESS
&smsCount=1&dr=000
&destination=002348xxxxx5348

Return a 2xx response

Your endpoint must quickly return a successful HTTP status (e.g., 200) before any complex logic that could cause a timeout.

PreviousWebhooksNextDemo

Last updated 11 days ago