You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/features/webhooks.md
+53-38Lines changed: 53 additions & 38 deletions
Original file line number
Diff line number
Diff line change
@@ -4,32 +4,34 @@ Webhooks offer a powerful mechanism to receive real-time notifications of events
4
4
5
5
## Supported Events 📩
6
6
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
+
<divclass="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>
33
35
34
36
## Prerequisites ✅
35
37
@@ -64,6 +66,7 @@ curl -X POST -u <username>:<password> \
64
66
```
65
67
66
68
Replace:
69
+
67
70
-`<username>:<password>`: Credentials from the Home tab of the app.
68
71
-`https://your-server.com/webhook`: The URL of your webhook endpoint.
69
72
-`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
75
78
76
79
### Step 3: Verify Your Webhook ✔️
77
80
78
-
You can verify that it has been successfully registered by executing the following `curl` command:
81
+
=== "Via API Method :material-api:"
79
82
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:"
84
91
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
+

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.
-**Review Registered Webhooks Periodically**: Regularly check the registered webhooks list to ensure the validity of URLs and ensure that the webhook is not compromised.
131
152
-**Use HTTPS**: Encrypts data in transit.
132
153
-**Secure Your Endpoint**: Protect your webhook endpoint against unauthorized access. For example, you can specify authorization key as query-parameter when registering the webhook.
@@ -234,12 +255,6 @@ The signing key is randomly generated at first request and can be changed in **S
234
255
- Ensure timestamp is UTC Unix time in seconds
235
256
- Use raw body before JSON decoding
236
257
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.
0 commit comments