diff --git a/config.sh b/config.sh index 7feefa4..3e3bc0a 100644 --- a/config.sh +++ b/config.sh @@ -38,7 +38,6 @@ INSIGHT_NUMBER=${INSIGHT_NUMBER:-""} WEBHOOK_URL=${WEBHOOK_URL:-""} # MMS -US_SHORT_CODE=${US_SHORT_CODE:-""} IMG_URL=${IMG_URL:-""} # Reporting diff --git a/dispatch/send-mms-with-failover.sh b/dispatch/send-mms-with-failover.sh new file mode 100755 index 0000000..ca6d2cb --- /dev/null +++ b/dispatch/send-mms-with-failover.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash + +source "../config.sh" +source "../jwt.sh" + +curl -X POST https://api.nexmo.com/v0.1/dispatch \ + -H 'Authorization: Bearer '$JWT\ + -H 'Content-Type: application/json' \ + -H 'Accept: application/json' \ + -d $'{ + "template":"failover", + "workflow": [ + { + "from": { "type": "mms", "number": '$FROM_NUMBER' }, + "to": { "type": "mms", "number": '$TO_NUMBER' }, + "message": { + "content": { + "type": "img", + "image": { "url": "$IMG_URL" } + } + }, + "failover":{ + "expiry_time": 600, + "condition_status": "read" + } + }, + { + "from": {"type": "sms", "number": '$FROM_NUMBER'}, + "to": { "type": "sms", "number": '$TO_NUMBER'}, + "message": { + "content": { + "type": "text", + "text": "This is an SMS sent via the Dispatch API" + } + } + } + ] + }' diff --git a/messages/send-mms-basic-auth.sh b/messages/send-mms.sh similarity index 89% rename from messages/send-mms-basic-auth.sh rename to messages/send-mms.sh index e8d5a33..4e201c5 100755 --- a/messages/send-mms-basic-auth.sh +++ b/messages/send-mms.sh @@ -1,7 +1,6 @@ #!/usr/bin/env bash source "../config.sh" -source "../jwt.sh" curl -X POST https://api.nexmo.com/v0.1/messages \ -u "$NEXMO_API_KEY:$NEXMO_API_SECRET" \ @@ -10,7 +9,7 @@ curl -X POST https://api.nexmo.com/v0.1/messages \ -d '{ "from":{ "type": "mms", - "number": "$US_SHORT_CODE" + "number": "$FROM_NUMBER" }, "to":{ "type": "mms",