> For the complete documentation index, see [llms.txt](https://doc.antgst.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.antgst.com/webhooks/test-webhooks.md).

# 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:

```java
@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

<mark style="color:$success;">**POST**</mark>

**Check event objects**

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

```html
URL: Your webhook

body:

{
    "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.

<br>
