Skip to content

Commit a09f741

Browse files
committed
[features] add webhooks UI docs entry
1 parent 4819449 commit a09f741

File tree

2 files changed

+53
-38
lines changed

2 files changed

+53
-38
lines changed

docs/assets/webhooks-list.png

6.18 KB
Loading

docs/features/webhooks.md

Lines changed: 53 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,34 @@ Webhooks offer a powerful mechanism to receive real-time notifications of events
44

55
## Supported Events 📩
66

7-
Currently, the following events are supported:
8-
9-
- `sms:received` - 📨 Triggered when an SMS is received by the device. The payload for this event includes:
10-
* `messageId`: The ID of the SMS message. **Note**: This ID is generated based on the message content and is not guaranteed to be unique. Do not rely on it as a unique identifier.
11-
* `message`: The content of the SMS message.
12-
* `phoneNumber`: The phone number that sent the SMS.
13-
* `simNumber`: The SIM card number that received the SMS. **May be `null`** on some Android devices.
14-
* `receivedAt`: The timestamp (in the device’s local timezone) when the message was received.
15-
- `sms:sent` - ✉️ Triggered when an SMS is sent by the device. The payload includes:
16-
* `messageId`: The ID of the SMS message.
17-
* `phoneNumber`: The recipient's phone number.
18-
* `simNumber`: The SIM card number that sent the SMS. **May be `null`** if the default SIM is used.
19-
* `sentAt`: The timestamp (device’s local timezone) when the message was sent.
20-
- `sms:delivered` - ✅ Triggered when an SMS is delivered to the recipient. The payload includes:
21-
* `messageId`: The ID of the SMS message.
22-
* `phoneNumber`: The recipient's phone number.
23-
* `simNumber`: The SIM card number that sent the SMS. **May be `null`** if the default SIM is used.
24-
* `deliveredAt`: The timestamp (device’s local timezone) when the message was delivered.
25-
- `sms:failed` - ❌ Triggered when an SMS fails to send or is not delivered. The payload includes:
26-
* `messageId`: The ID of the SMS message.
27-
* `phoneNumber`: The recipient's phone number.
28-
* `simNumber`: The SIM card number that sent the SMS. **May be `null`** if the default SIM is used.
29-
* `failedAt`: The timestamp (device’s local timezone) when the failure occurred.
30-
* `reason`: The failure reason.
31-
- `system:ping` - 🏓 Triggered when the device pings the server. The payload includes:
32-
* `health`: The healthcheck response, as described in the [Healthcheck documentation](./health.md).
7+
<div class="grid cards" markdown>
8+
9+
- :incoming_envelope: **sms:received**
10+
- `messageId`: Content-based ID
11+
- `message`: SMS content
12+
- `phoneNumber`: Sender's number
13+
- `simNumber`: SIM index (nullable)
14+
- `receivedAt`: Local timestamp
15+
16+
- :outbox_tray: **sms:sent**
17+
- `messageId`: Unique ID
18+
- `phoneNumber`: Recipient
19+
- `simNumber`: SIM index (nullable)
20+
- `sentAt`: Local timestamp
21+
22+
- :white_check_mark: **sms:delivered**
23+
- `messageId`: Unique ID
24+
- `phoneNumber`: Recipient
25+
- `deliveredAt`: Local timestamp
26+
27+
- :x: **sms:failed**
28+
- `reason`: Error details
29+
- `failedAt`: Local timestamp
30+
31+
- :ping_pong: **system:ping**
32+
- `health`: [Healthcheck status](./health.md)
33+
34+
</div>
3335

3436
## Prerequisites ✅
3537

@@ -64,6 +66,7 @@ curl -X POST -u <username>:<password> \
6466
```
6567

6668
Replace:
69+
6770
- `<username>:<password>`: Credentials from the Home tab of the app.
6871
- `https://your-server.com/webhook`: The URL of your webhook endpoint.
6972
- `https://api.sms-gate.app/3rdparty/v1/webhooks`: The appropriate URL for your mode.
@@ -75,14 +78,31 @@ In Cloud and Private modes, please allow some time for the webhooks list to sync
7578

7679
### Step 3: Verify Your Webhook ✔️
7780

78-
You can verify that it has been successfully registered by executing the following `curl` command:
81+
=== "Via API Method :material-api:"
7982

80-
```sh title="Cloud mode example"
81-
curl -X GET -u <username>:<password> \
82-
https://api.sms-gate.app/3rdparty/v1/webhooks
83-
```
83+
You can verify that it has been successfully registered by executing the following `curl` command:
84+
85+
```sh title="Cloud mode example"
86+
curl -X GET -u <username>:<password> \
87+
https://api.sms-gate.app/3rdparty/v1/webhooks
88+
```
89+
90+
=== "Via App Interface :material-cellphone:"
8491

85-
**Local mode** and **Cloud/Private mode** maintain separate webhook lists. Use the corresponding API URL to view registrations.
92+
1. Open the SMS Gateway app 📱
93+
2. Navigate to **Settings** > **Webhooks** > **Registered webhooks**
94+
3. The list shows all configured webhooks with:
95+
- Endpoint URL
96+
- Webhook ID
97+
- Event type
98+
- Source (Local/Cloud)
99+
<center>
100+
![Webhooks List](../assets/webhooks-list.png)
101+
</center>
102+
You can copy the webhook ID by clicking on the row.
103+
104+
!!! note "Separate Lists"
105+
**Local mode** and **Cloud/Private mode** maintain separate webhook lists. Use the corresponding API URL to view registrations.
86106

87107
### Step 4: Test the Webhook 🧪
88108

@@ -128,6 +148,7 @@ curl -X DELETE -u <username>:<password> \
128148

129149
## Security Considerations 🔐
130150

151+
- **Review Registered Webhooks Periodically**: Regularly check the registered webhooks list to ensure the validity of URLs and ensure that the webhook is not compromised.
131152
- **Use HTTPS**: Encrypts data in transit.
132153
- **Secure Your Endpoint**: Protect your webhook endpoint against unauthorized access. For example, you can specify authorization key as query-parameter when registering the webhook.
133154
- **Rotate Credentials**: Regularly update passwords.
@@ -234,12 +255,6 @@ The signing key is randomly generated at first request and can be changed in **S
234255
- Ensure timestamp is UTC Unix time in seconds
235256
- Use raw body before JSON decoding
236257

237-
## Conclusion 🎉
238-
239-
By following these steps, you've successfully integrated webhooks into your system to receive real-time notifications for incoming SMS messages. This setup enables you to respond to messages promptly and automate workflows based on SMS content.
240-
241-
Remember to adhere to best practices for security and perform thorough testing to ensure reliable webhook delivery.
242-
243258
## References 📚
244259

245260
- [FAQ](../faq/webhooks.md)

0 commit comments

Comments
 (0)