-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[webhooks] add getting started for webhooks
- Loading branch information
Showing
6 changed files
with
63 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Getting Started | ||
|
||
## Webhooks | ||
|
||
Webhooks can be utilized to get notifications of incoming SMS messages. | ||
|
||
Follow these steps to set up webhooks: | ||
|
||
1. Set up your own HTTP server with a valid SSL certificate to receive webhooks. For testing purposes, [webhook.site](https://webhook.site) can be useful. | ||
2. Register your webhook with an API request: | ||
|
||
```sh | ||
curl -X POST -u <username>:<password> \ | ||
-H "Content-Type: application/json" \ | ||
-d '{ "id": "unique-id", "url": "https://webhook.site/<your-uuid>", "event": "sms:received" }' \ | ||
http://<device_local_ip>:8080/webhooks | ||
``` | ||
|
||
3. Send an SMS to the device. | ||
4. The application will dispatch POST request to the specified URL with a payload such as: | ||
|
||
```json | ||
{ | ||
"event": "sms:received", | ||
"payload": { | ||
"message": "Received SMS text", | ||
"phoneNumber": "+79990001234", | ||
"receivedAt": "2024-06-07T11:41:31.000+07:00" | ||
} | ||
} | ||
``` | ||
|
||
5. To deregister a webhook, execute a `curl` request using the following pattern: | ||
|
||
```sh | ||
curl -X DELETE -u <username>:<password> \ | ||
http://<device_local_ip>:8080/webhooks/unique-id | ||
``` | ||
|
||
*Note*: Webhooks are transmitted directly from the device; therefore, the device must have an outgoing internet connection. As the requests originate from the device, incoming messages remain inaccessible to us. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters