Skip to content

Commit

Permalink
Merge pull request #69 from capcom6/feature/webhooks
Browse files Browse the repository at this point in the history
Add webhooks support
  • Loading branch information
capcom6 authored Jun 18, 2024
2 parents ebb97a8 + 468d978 commit 8617800
Show file tree
Hide file tree
Showing 40 changed files with 1,382 additions and 233 deletions.
20 changes: 20 additions & 0 deletions api/local.http
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,23 @@ Authorization: Basic {{localCredentials}}
###
GET {{localUrl}}/message/8GN2Pz-fzu73NL3398ROE HTTP/1.1
Authorization: Basic {{localCredentials}}

###
GET {{localUrl}}/webhooks HTTP/1.1
Authorization: Basic {{localCredentials}}

###
POST {{localUrl}}/webhooks HTTP/1.1
Authorization: Basic {{localCredentials}}
Content-Type: application/json

{
"id": "LreFUt-Z3sSq0JufY9uWB",
"url": "https://webhook.site/280a6655-eb68-40b9-b857-af5be37c5303",
"event": "sms:received"
}

###
DELETE {{localUrl}}/webhooks/LreFUt-Z3sSq0JufY9uWB HTTP/1.1
Authorization: Basic {{localCredentials}}

43 changes: 43 additions & 0 deletions api/mobile.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
@baseUrl={{$dotenv CLOUD__URL}}/api/mobile/v1
@mobileToken={{$dotenv MOBILE__TOKEN}}
@phone={{$dotenv PHONE}}

###
POST {{baseUrl}}/device HTTP/1.1
Authorization: Bearer 123456789
Content-Type: application/json

{
"name": "Android Phone",
"pushToken": "eTxx88nfSla87gZuJcW5mS:APA91bHGxVgSqqRtxwFHD1q9em5Oa6xSP4gO_OZRrqOoP1wjf_7UMfXKsc4uws6rWkqn73jYCc1owyATB1v61mqak4ntpqtmRkNtTey7NQXa0Wz3uQZBWY-Ecbn2rWG2VJRihOzXRId-"
}

###
GET {{baseUrl}}/message HTTP/1.1
Authorization: Bearer {{mobileToken}}

###
PATCH {{baseUrl}}/message HTTP/1.1
Authorization: Bearer {{mobileToken}}
Content-Type: application/json

[
{
"id": "2dcIAhcLg81cez7GE_Pdp",
"state": "Failed",
"recipients": [
{
"phoneNumber": "{{phone}}",
"state": "Failed"
}
],
"states": {
"Processed": "2024-05-13T16:49:17.357+07:00",
"Failed": "2024-05-13T16:49:17.357+07:00"
}
}
]

###
GET {{baseUrl}}/webhooks HTTP/1.1
Authorization: Bearer {{mobileToken}}
52 changes: 18 additions & 34 deletions api/requests.http
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,6 @@ GET {{baseUrl}}/health HTTP/1.1
###
GET {{baseUrl}}/api/3rdparty/v1/health HTTP/1.1

###
POST {{baseUrl}}/api/mobile/v1/device HTTP/1.1
Authorization: Bearer 123456789
Content-Type: application/json

{
"name": "Android Phone",
"pushToken": "eTxx88nfSla87gZuJcW5mS:APA91bHGxVgSqqRtxwFHD1q9em5Oa6xSP4gO_OZRrqOoP1wjf_7UMfXKsc4uws6rWkqn73jYCc1owyATB1v61mqak4ntpqtmRkNtTey7NQXa0Wz3uQZBWY-Ecbn2rWG2VJRihOzXRId-"
}

###
POST {{baseUrl}}/api/3rdparty/v1/message?skipPhoneValidation=false HTTP/1.1
Content-Type: application/json
Expand Down Expand Up @@ -59,37 +49,31 @@ GET {{baseUrl}}/api/3rdparty/v1/device HTTP/1.1
Authorization: Basic {{credentials}}

###
GET {{baseUrl}}/api/mobile/v1/message HTTP/1.1
Authorization: Bearer {{mobileToken}}

###
PATCH {{baseUrl}}/api/mobile/v1/message HTTP/1.1
Authorization: Bearer {{mobileToken}}
POST {{baseUrl}}/api/upstream/v1/push HTTP/1.1
Content-Type: application/json

[
{
"id": "2dcIAhcLg81cez7GE_Pdp",
"state": "Failed",
"recipients": [
{
"phoneNumber": "{{phone}}",
"state": "Failed"
}
],
"states": {
"Processed": "2024-05-13T16:49:17.357+07:00",
"Failed": "2024-05-13T16:49:17.357+07:00"
}
"token": "eTxx88nfSla87gZuJcW5mS:APA91bHGxVgSqqRtxwFHD1q9em5Oa6xSP4gO_OZRrqOoP1wjf_7UMfXKsc4uws6rWkqn73jYCc1owyATB1v61mqak4ntpqtmRkNtTey7NQXa0Wz3uQZBWY-Ecbn2rWG2VJRihOzXRId-"
}
]

###
POST {{baseUrl}}/api/upstream/v1/push HTTP/1.1
GET {{baseUrl}}/api/3rdparty/v1/webhooks HTTP/1.1
Authorization: Basic {{credentials}}

###
POST {{baseUrl}}/api/3rdparty/v1/webhooks HTTP/1.1
Authorization: Basic {{credentials}}
Content-Type: application/json

[
{
"token": "eTxx88nfSla87gZuJcW5mS:APA91bHGxVgSqqRtxwFHD1q9em5Oa6xSP4gO_OZRrqOoP1wjf_7UMfXKsc4uws6rWkqn73jYCc1owyATB1v61mqak4ntpqtmRkNtTey7NQXa0Wz3uQZBWY-Ecbn2rWG2VJRihOzXRId-"
}
]
{
"id": "MYofX8bTd5Bov0wWFZLRP",
"url": "https://webhook.site/280a6655-eb68-40b9-b857-af5be37c5303",
"event": "sms:received"
}

###
DELETE {{baseUrl}}/api/3rdparty/v1/webhooks/MYofX8bTd5Bov0wWFZLRP HTTP/1.1
Authorization: Basic {{credentials}}

Loading

0 comments on commit 8617800

Please sign in to comment.