TextMarks wants to hear from you

You'll find many helpful knowledge base articles here. If you need assistance, please:

We're here to help! If you're looking for your TextMarks dashboard or more information on TextMarks, please visit our main site at www.TextMarks.com.



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.

SMS Request

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 MYCAFE).
  • User sends a text message beginning with your keyword and followed by additional information to 41411 (eg MYCAFE SPECIALS).
  • User texts a short "contextual response" shortly after texting your keyword (eg MYCAFE which might respond with a multiple choice menu, and then S to 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 (\0 is replaced with everything following your keyword) and the user's phone number (\p is replaced with the phone number sending the text):

http://your.server.com/script.php?msg=\0&phone=\p

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!

Response

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 (\p) or 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.

Limitations

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.