Bring It All Together
Now, that you have created an endpoint with a callback-handling application and configured a callback either through the Portal or programmatically, you can test how the callback works.
From your mobile phone, send the word HELP
to your number rented from CarrierX. Here's what happens afterwards:
- CarrierX receives the message and makes a callback with the
inbound
message JSON data, to your callback URL. - The python application you have configured and hosted at the callback URL
-
parses the JSON data of the callback by checking that
- the initial message direction was
inbound
- the message contained the help keyword
- the initial message direction was
-
sends the preformatted
HELP_RESPONSE
back to your mobile number from the CarrierX number to which you sentHELP
:Sample Company
Contact customer support at 800-555-1212
Text STOP to stop all messages
Msg&Data rates may applyThe help response contains three required elements: the company name, an email or a phone number and information on how to opt out of receiving further messages.
-
Now, CarrierX is sending the message to the mobile carrier and will start to report back as the message passes stages of delivery.
- CarrierX makes another callback, telling your application that the outbound message has been
sent
. - Finally, upon the message delivery to the mobile phone, CarrierX makes the last callback with a
status
ofdelivered
.
The following flowchart demonstrates the whole process in detail.