File tree Expand file tree Collapse file tree 12 files changed +371
-302
lines changed Expand file tree Collapse file tree 12 files changed +371
-302
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ VIBER_SERVICE_MESSAGE_ID=${VIBER_SERVICE_MESSAGE_ID:-""}
2828# For WhatsApp messaging
2929WHATSAPP_NUMBER=${WHATSAPP_NUMBER:- " " }
3030WHATSAPP_TEMPLATE_NAMESPACE=${WHATSAPP_TEMPLATE_NAMESPACE:- " whatsapp:hsm:technology:nexmo" }
31- WHATSAPP_TEMPLATE_NAME=${WHATSAPP_TEMPLATE_NAME:- " verify " }
31+ WHATSAPP_TEMPLATE_NAME=${WHATSAPP_TEMPLATE_NAME:- " " }
3232WHATSAPP_AUTH_TEMPLATE_NAME=${WHATSAPP_AUTH_TEMPLATE_NAME:- " " }
3333WHATSAPP_TEMPLATE_REPLACEMENT_TEXT=${WHATSAPP_TEMPLATE_REPLACEMENT_TEXT:- " " }
3434
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ source " ../../config.sh"
4+ source " ../../jwt.sh"
5+
6+ curl -X POST " ${MESSAGES_API_URL} " \
7+ -H " Authorization: Bearer ${JWT} " \
8+ -H ' Content-Type: application/json' \
9+ -H ' Accept: application/json' \
10+ -d $' {
11+ "to": "' ${MESSAGES_TO_NUMBER} ' ",
12+ "from": "' ${MMS_SENDER_ID} ' ",
13+ "channel": "mms",
14+ "message_type": "audio",
15+ "audio": {
16+ "url": "' ${MESSAGES_AUDIO_URL} ' "
17+ }
18+ }'
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ source " ../../config.sh"
4+ source " ../../jwt.sh"
5+
6+ curl -X POST " ${MESSAGES_API_URL} " \
7+ -H " Authorization: Bearer ${JWT} " \
8+ -H ' Content-Type: application/json' \
9+ -H ' Accept: application/json' \
10+ -d $' {
11+ "to": "' ${MESSAGES_TO_NUMBER} ' ",
12+ "from": "' ${MMS_SENDER_ID} ' ",
13+ "channel": "mms",
14+ "message_type": "vcard",
15+ "vcard": {
16+ "url": "' ${MESSAGES_VCARD_URL} ' "
17+ }
18+ }'
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ source " ../../config.sh"
4+ source " ../../jwt.sh"
5+
6+ curl -X POST " ${MESSAGES_API_URL} " \
7+ -H " Authorization: Bearer ${JWT} " \
8+ -H ' Content-Type: application/json' \
9+ -H ' Accept: application/json' \
10+ -d $' {
11+ "to": "' ${MESSAGES_TO_NUMBER} ' ",
12+ "from": "' ${MMS_SENDER_ID} ' ",
13+ "channel": "mms",
14+ "message_type": "video",
15+ "video": {
16+ "url": "' ${MESSAGES_VIDEO_URL} ' "
17+ }
18+ }'
Original file line number Diff line number Diff line change 33source " ../../config.sh"
44source " ../../jwt.sh"
55
6- curl -X POST https://api.nexmo.com/v1/messages \
7- -H ' Authorization: Bearer ' $ JWT \
6+ curl -X POST " ${MESSAGES_API_URL} " \
7+ -H " Authorization: Bearer ${ JWT} " \
88 -H ' Content-Type: application/json' \
99 -H ' Accept: application/json' \
1010 -d $' {
11- "message_type": "image",
12- "image": {
13- "url": "https://example.com/image.jpg"
14- },
15- "to": "' $TO_NUMBER ' ",
16- "from": "' $FROM_NUMBER ' ",
17- "channel": "mms"
18- }'
19-
11+ "to": "' ${MESSAGES_TO_NUMBER} ' ",
12+ "from": "' ${MMS_SENDER_ID} ' ",
13+ "channel": "mms",
14+ "message_type": "image",
15+ "image": {
16+ "url": "' ${MESSAGES_IMAGE_URL} ' "
17+ }
18+ }'
Original file line number Diff line number Diff line change 33source " ../../config.sh"
44source " ../../jwt.sh"
55
6- curl -X POST $MESSAGES_API_URL \
7- -H ' Authorization: Bearer' $JWT \
8- -H ' Content-Type: application/json' \
9- -d ' {
10- "to": "' $TO_NUMBER ' ",
11- "from": "' $WHATSAPP_NUMBER ' ",
12- "channel": "whatsapp",
13- "message_type": "custom",
14- "custom": {
15- "type": "template",
16- "template": {
17- "name": "' $WHATSAPP_AUTH_TEMPLATE_NAME ' ",
18- "language": {
19- "policy": "deterministic",
20- "code": "en"
21- },
22- "components": [
23- {
24- "type": "body",
25- "parameters": [
26- {
27- "type": "text",
28- "text": "' $OTP ' "
29- }
30- ]
6+ curl -X POST " ${MESSAGES_API_URL} " \
7+ -H " Authorization: Bearer ${JWT} " \
8+ -H ' Content-Type: application/json' \
9+ -H ' Accept: application/json' \
10+ -d $' {
11+ "to": "' ${MESSAGES_TO_NUMBER} ' ",
12+ "from": "' ${WHATSAPP_SENDER_ID} ' ",
13+ "channel": "whatsapp",
14+ "message_type": "custom",
15+ "custom": {
16+ "type": "template",
17+ "template": {
18+ "name": "' ${WHATSAPP_TEMPLATE_NAME} ' ",
19+ "language": {
20+ "policy": "deterministic",
21+ "code": "en"
3122 },
32- {
33- "type": "button",
34- "sub_type": "url",
35- "index": "0",
36- "parameters": [
37- {
38- "type": "text",
39- "text": "' $OTP ' "
40- }
41- ]
42- }
43- ]
23+ "components": [
24+ {
25+ "type": "body",
26+ "parameters": [
27+ {
28+ "type": "text",
29+ "text": "' ${WHATSAPP_OTP} ' "
30+ }
31+ ]
32+ },
33+ {
34+ "type": "button",
35+ "sub_type": "url",
36+ "index": "0",
37+ "parameters": [
38+ {
39+ "type": "text",
40+ "text": "' ${WHATSAPP_OTP} ' "
41+ }
42+ ]
43+ }
44+ ]
45+ }
4446 }
45- }
46- }'
47+ }'
Original file line number Diff line number Diff line change 33source " ../../config.sh"
44source " ../../jwt.sh"
55
6- curl -X POST $MESSAGES_API_URL \
7- -H ' Authorization: Bearer' $JWT \
8- -H ' Content-Type: application/json' \
9- -d ' {
10- "message_type": "custom",
11- "to": "' $TO_NUMBER ' ",
12- "from": "' $WHATSAPP_NUMBER ' ",
13- "channel": "whatsapp",
14- "custom": {
15- "type": "template",
16- "template": {
17- "namespace": "' $WHATSAPP_TEMPLATE_NAMESPACE ' ",
18- "name": "' $WHATSAPP_TEMPLATE_NAME ' ",
19- "language": {
20- "code": "en",
21- "policy": "deterministic"
22- },
23- "components": [
24- {
25- "type": "header",
26- "parameters": [
27- {
28- "type": "image",
29- "image": {
30- "link": "' $HEADER_IMAGE_URL ' "
31- }
32- }
33- ]
34- },
35- {
36- "type": "body",
37- "parameters": [
38- {
39- "type": "text",
40- "text": "Anand"
41- },
42- {
43- "type": "text",
44- "text": "Quest"
45- },
46- {
47- "type": "text",
48- "text": "113-0921387"
49- },
50- {
51- "type": "text",
52- "text": "23rd Nov 2019"
53- }
54- ]
6+ curl -X POST " ${MESSAGES_API_URL} " \
7+ -H " Authorization: Bearer ${JWT} " \
8+ -H ' Content-Type: application/json' \
9+ -H ' Accept: application/json' \
10+ -d $' {
11+ "to": "' ${MESSAGES_TO_NUMBER} ' ",
12+ "from": "' ${WHATSAPP_SENDER_ID} ' ",
13+ "channel": "whatsapp",
14+ "message_type": "custom",
15+ "custom": {
16+ "type": "template",
17+ "template": {
18+ "name": "' ${WHATSAPP_TEMPLATE_NAME} ' ",
19+ "language": {
20+ "policy": "deterministic",
21+ "code": "en"
5522 },
56- {
57- "type": "button",
58- "index": "0",
59- "sub_type": "url",
60- "parameters": [
61- {
62- "type": "text",
63- "text": "1Z999AA10123456784"
64- }
65- ]
66- }
67- ]
23+ "components": [
24+ {
25+ "type": "header",
26+ "parameters": [
27+ {
28+ "type": "image",
29+ "image": {
30+ "link": "' ${MESSAGES_IMAGE_URL} ' "
31+ }
32+ }
33+ ]
34+ },
35+ {
36+ "type": "body",
37+ "parameters": [
38+ {
39+ "type": "text",
40+ "text": "Joe Bloggs"
41+ },
42+ {
43+ "type": "text",
44+ "text": "AB123456"
45+ }
46+ ]
47+ },
48+ {
49+ "type": "button",
50+ "index": "0",
51+ "sub_type": "url",
52+ "parameters": [
53+ {
54+ "type": "text",
55+ "text": "AB123456"
56+ }
57+ ]
58+ }
59+ ]
60+ }
6861 }
69- }
70- }'
62+ }'
You can’t perform that action at this time.
0 commit comments