Skip to content

Commit 68c1951

Browse files
committed
Updating RCS and Messenger snippets
1 parent 4ff9251 commit 68c1951

20 files changed

+390
-466
lines changed

messages/messenger/send-audio.sh

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@
33
source "../../config.sh"
44
source "../../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": "audio",
11-
"audio": {
12-
"url": "'$AUDIO_URL'"
13-
},
14-
"to": "'$FB_RECIPIENT_ID'",
15-
"from": "'$FB_SENDER_ID'",
16-
"channel": "messenger"
17-
}'
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": "'${MESSENGER_RECIPIENT_ID}'",
12+
"from": "'${MESSENGER_SENDER_ID}'",
13+
"channel": "messenger",
14+
"message_type": "audio",
15+
"audio": {
16+
"url": "'${MESSAGES_AUDIO_URL}'"
17+
}
18+
}'

messages/messenger/send-file.sh

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@
33
source "../../config.sh"
44
source "../../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": "file",
11-
"file": {
12-
"url": "'$FILE_URL'"
13-
},
14-
"to": "'$FB_RECIPIENT_ID'",
15-
"from": "'$FB_SENDER_ID'",
16-
"channel": "messenger"
17-
}'
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": "'${MESSENGER_RECIPIENT_ID}'",
12+
"from": "'${MESSENGER_SENDER_ID}'",
13+
"channel": "messenger",
14+
"message_type": "file",
15+
"file": {
16+
"url": "'${MESSAGES_FILE_URL}'"
17+
}
18+
}'

messages/messenger/send-image.sh

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@
33
source "../../config.sh"
44
source "../../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": "image",
11-
"image": {
12-
"url": "'$IMAGE_URL'"
13-
},
14-
"to": "'$FB_RECIPIENT_ID'",
15-
"from": "'$FB_SENDER_ID'",
16-
"channel": "messenger"
17-
}'
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": "'${MESSENGER_RECIPIENT_ID}'",
12+
"from": "'${MESSENGER_SENDER_ID}'",
13+
"channel": "messenger",
14+
"message_type": "image",
15+
"image": {
16+
"url": "'${MESSAGES_IMAGE_URL}'"
17+
}
18+
}'

messages/messenger/send-template.sh

Lines changed: 0 additions & 80 deletions
This file was deleted.

messages/messenger/send-text.sh

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
source "../../config.sh"
44
source "../../jwt.sh"
55

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-
"message_type": "text",
12-
"text": "This is a Facebook Messenger Message sent from the Messages API",
13-
"to": "'$FB_RECIPIENT_ID'",
14-
"from": "'$FB_SENDER_ID'",
15-
"channel": "messenger"
16-
}'
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": "'${MESSENGER_RECIPIENT_ID}'",
12+
"from": "'${MESSENGER_SENDER_ID}'",
13+
"channel": "messenger",
14+
"message_type": "text",
15+
"text": "This is a Facebook Messenger text message sent using the Vonage Messages API."
16+
}'

messages/messenger/send-video.sh

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@
33
source "../../config.sh"
44
source "../../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": "video",
11-
"video": {
12-
"url": "'$VIDEO_URL'"
13-
},
14-
"to": "'$FB_RECIPIENT_ID'",
15-
"from": "'$FB_SENDER_ID'",
16-
"channel": "messenger"
17-
}'
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": "'${MESSENGER_RECIPIENT_ID}'",
12+
"from": "'${MESSENGER_SENDER_ID}'",
13+
"channel": "messenger",
14+
"message_type": "video",
15+
"video": {
16+
"url": "'${MESSAGES_VIDEO_URL}'"
17+
}
18+
}'

messages/rcs/revoke-message.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
source "../../config.sh"
44
source "../../jwt.sh"
55

6-
curl -X PATCH $GEOSPECIFIC_MESSAGES_API_URL'/'$MESSAGE_UUID \
7-
-H 'Authorization: Bearer '$JWT \
8-
-H 'Content-Type: application/json' \
9-
-H 'Accept: application/json' \
10-
-d $'{"status": "revoked"}'
6+
curl -X PATCH "${GEOSPECIFIC_MESSAGES_API_URL}/${MESSAGES_MESSAGE_ID}" \
7+
-H "Authorization: Bearer ${JWT}"\
8+
-H 'Content-Type: application/json' \
9+
-H 'Accept: application/json' \
10+
-d $'{"status": "revoked"}'

messages/rcs/send-file.sh

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
source "../../config.sh"
44
source "../../jwt.sh"
55

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-
"message_type": "file",
12-
"file": {
13-
"url": "'$FILE_URL'"
14-
},
15-
"to": "'$TO_NUMBER'",
16-
"from": "'$RCS_SENDER_ID'",
17-
"channel": "rcs"
18-
}'
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": "'${RCS_SENDER_ID}'",
13+
"channel": "rcs",
14+
"message_type": "file",
15+
"file": {
16+
"url": "'${MESSAGES_FILE_URL}'"
17+
}
18+
}'

messages/rcs/send-image.sh

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
source "../../config.sh"
44
source "../../jwt.sh"
55

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-
"message_type": "image",
12-
"image": {
13-
"url": "'$IMAGE_URL'"
14-
},
15-
"to": "'$TO_NUMBER'",
16-
"from": "'$RCS_SENDER_ID'",
17-
"channel": "rcs"
18-
}'
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": "'${RCS_SENDER_ID}'",
13+
"channel": "rcs",
14+
"message_type": "image",
15+
"image": {
16+
"url": "'${MESSAGES_IMAGE_URL}'"
17+
}
18+
}'

0 commit comments

Comments
 (0)