Skip to content

Commit 2eac1d4

Browse files
authored
Merge pull request #19 from Nexmo/tony-dispatch-whatsapp
Add WhatsApp building block
2 parents 3345088 + 41b91bb commit 2eac1d4

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/bash
2+
3+
source "../config.sh"
4+
source "../jwt.sh"
5+
6+
curl -X POST https://api.nexmo.com/v0.1/dispatch \
7+
-H 'Authorization: Bearer '$JWT\
8+
-H 'Content-Type: application/json' \
9+
-H 'Accept: application/json' \
10+
-d $'{
11+
"template":"failover",
12+
"workflow": [
13+
{
14+
"from": { "type": "whatsapp", "number": '$WHATSAPP_NUMBER' },
15+
"to": { "type": "whatsapp", "number": '$TO_NUMBER' },
16+
"message": {
17+
"content": {
18+
"type": "text",
19+
"text": "This is a WhatsApp Message sent via the Dispatch API"
20+
}
21+
},
22+
"failover":{
23+
"expiry_time": 600,
24+
"condition_status": "read"
25+
}
26+
},
27+
{
28+
"from": {"type": "sms", "number": '$FROM_NUMBER'},
29+
"to": { "type": "sms", "number": '$TO_NUMBER'},
30+
"message": {
31+
"content": {
32+
"type": "text",
33+
"text": "This is an SMS sent via the Dispatch API"
34+
}
35+
}
36+
}
37+
]
38+
}'

0 commit comments

Comments
 (0)