TextMarks wants to hear from you
You'll find many helpful knowledge base articles here. If you need assistance, please:
- email us at firstname.lastname@example.org
- call us at (800) 696-1393
Request / Response Interaction Overview
Dynamic Request / Response Overview
TextMarks supports SMS request/response interactions and allows you to build simple or sophisticated SMS user interactions that tie into your own database or live applications.
Register a keyword on TextMarks shared short code "41411" and you control what happens when users text your keyword to 41411.
When a user sends a text message to 41411 in any of the following situations, TextMarks will initiate an HTTP callback to a script at a URL specified by you:
- User sends a text message with your keyword to 41411 (eg
- User sends a text message beginning with your keyword and
followed by additional information to 41411 (eg
- User texts a short "contextual
response" shortly after texting your keyword (eg
MYCAFEwhich might respond with a multiple choice menu, and then
Sto indicate specials, allowing the user to reply without specifying your keyword again).
Your Callback Script
Your script can be written in any language (PHP, Python, Ruby, Java, JSP, ASP, C#, .NET, etc.) and hosted on any public server.
By specifying magic tokens in the URL that are substituted at callback time, you can selectively pass back information to your script including the user's phone number, additional text provided after the keyword, and more.
An example callback URL which would allow you to access (as if
they were form fields) to the user's text message (
is replaced with everything following your keyword) and the user's
phone number (
\p is replaced with the phone number
sending the text):
Because you specify the URL and TextMarks substitutes information into the URL where desired, you can even tie into existing legacy scripts without any changes simply by submitting a compatible URL for your callback!
Your script can process the request (looking up information in a database, executing transactions, recording information, fetching additional information, etc.) and then optionally respond back.
Whatever text you respond with is sent back to the user as an SMS message from 41411. This is so easy, you won't believe how quickly you can build your interactions. No XML parsing or generating. Just read the query parameters (as if a form had been posted), and output some text, and you have a request/response SMS interaction!
If you don't want to respond, simply respond with nothing. If your script is silent, TextMarks won't send an SMS back to the user.
With the example callback URL above, you could host this PHP script and have a working (albeit basic) SMS interaction!
<?php echo "Hello! Your phone# is " . $_REQUEST['phone']; echo "and you said: " . $_REQUEST['msg']; ?>
Keeping State ("Sessions")
The TextMarks HTTP callbacks will neither receive nor accept any
cookies your server provides. For this reason, standard session
variables (such as PHP's
$_SESSION) will not be
available to your script.
In order to keep state between requests, you may wish to
identify users uniquely by their phone number (
user ID (
\u) and store session data in your own DB or
memcache associated with the user. As an example, you might
store/retrieve an array of variables in your cache with a key
string constructed based on the user's ID.
While this type of request / response interaction, your callback script must execute and respond within 10 seconds or TextMarks will time out and send an error message back to the user. This limitation is in place because of the shared nature of our short code and resources and is designed to maintain instant responsiveness for all customers.
Another limitation of this type of request / response interaction is that your response is limited to a single text message.
Both of these limitations may be addressed with a more
complicated integration. See
Recipe: Request / Response with Long Processing or Multiple Responses.