The SCG Cloud Messaging APIs offers an option attribute on its messaging API endpoint that allows customers to have the system perform a number verification for validity before deciding if the message should be sent to the recipient or not.
This feature allows customers to determine if a number is a landline or mobile number or an invalid number which helps to avoid sending messages to invalid numbers.
How to Send a Messaging with number verification flag
To send a SMS message using the number verification flag, include the following attribute and value in the message submission
- Set "verify_number" : " true" if you want to perform a verification
- Set "verify_number" : " False" if you dont want to. You also choose not to include the atriibute at all
curl -X POST \
https://api.syniverse.com/scg-external-api/api/v1/messaging/messages\
-H 'Authorization: Bearer <Token>' \
-H 'Content-Type: application/json' \
-d '{"from":"address:222222","to":["+14085551111"],"body":"TEST MESSAGE", "verify_number":true}'
If you have your webhook setup to receive Delivery confirmation, can expect to see the following field in your Delivery receipt event if the number valid
- "number_type" : "M" or "VL", L
where M = Mobile, VL= Virtual Longcode, L = Landline
Sample DR Event
{
"topic": "SCG-Message",
"attempt": 1,
"event": {
"fld-val-list": {
"previous_state": "QUEUED",
"message_request_id": "44Sb8nOEQBGL4uCkxmVnT5",
"message_id": "gYSpaGHxb5X6OqStyGICy7",
"to_address": "+14085551111",
"has_attachment": false,
"reason_description": "SUCCESS",
"number_type": "M",
"application_id": 1764,
"reason_code": "200",
"sender_id_alias": "RexWQXiD7pF7Kzvepjkio",
"company-id": xxxx,
"sender_id_id": "RexWQXiD7pF7Kzvepijkio",
"external_message_request_id": "",
"new_state": "SENT",
"fragments_count": 1,
"from_address": "222222",
"mt_price": 0.0125
},
"evt-tp": "message_state_change",
"timestamp": "2019-02-05T18:25:22.76Z"
},
"event-id": "CLIxCr7ZRfeBUHHYP3eZQQ"
}
In the case of the number not being valid, the DR event will have the failed response with a reason description, see below:
{ "topic": "SCG-Message", "attempt": 1, "event": { "fld-val-list": { "previous_state": "QUEUED", "message_request_id": "N6xNcTYqtkFXr3XTzsRmH1", "message_id": "N6xNcTYqtkFXr3XTzsRmH1", "to_address": "+14085551111", "has_attachment": false, "reason_description": "Invalid Recipient - Validity: true NumberType: L", "number_type": "L", "application_id": 4334, "reason_code": "1002", "sender_id_alias": "RexWQXiD7pF7Kzvepikol", "company-id": 1512, "sender_id_id": "RexWQXiD7pF7Kzvepikol", "external_message_request_id": "", "new_state": "FAILED", "fragments_count": 1, "from_address": "222222", "mt_price": 0 }, "evt-tp": "message_state_change", "timestamp": "2019-02-05T21:07:42.393Z" }, "event-id": "UZEbBkKjT0_wXTK9Jd_WFw" }
0 Comments