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


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://doc.antgst.com/webhooks/test-webhooks.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
