4.18j

TextMarks API V2 - AutoDoc: TextMarkManager / set_dynamic_request_handler()

Method: set_dynamic_request_handler() (POST) - Configure dynamic request handler

Package: TextMarkManager - Manage a TextMark owned by authenticated user (... View package)

Args:

Req? Name Type Description Test
REQ auth_user User User account / phone# used for login
REQ auth_pass Password Password
REQ tm TextMark TextMark keyword/TRI owned by auth_user
REQ url URLs (space-sep) Dynamic script URL (to call on each request)
OPT api_key API Key API Key (Register here)
OPT notify_sms Bool (0/1) Notify manager (by SMS) when requested

Test:


Docs:

  • Set TextMark such that when somebody texts the keyword tm to 41411, TextMarks servers will make an HTTP request to a script on a 3rd party server that operates on request data and returns raw text that is sent back to the requesting user as SMS.
  • The remote server should complete processing within 10 seconds, or the request may time out.
  • You may pass along additional request data (including text sent by the user immediately following the keyword) by including special variables in the URL that get substituted at run-time:
    \p
    replaced with the user's canonical phone number, e.g. "+14151234567".
    \0
    replaced with all of the text following your keyword in the message, e.g. \0 will become "this is a test" from the message "YOURKEYWORD this is a test". (This is a zero, not an uppercase O.)
    \n
    replaced with the user's real name (if set), e.g. "Jim Jones".
    \u
    replaced with a unique numerical identifier for the user's phone, e.g. "4789234".
    \1 - \9
    replaced with the corresponding words following your keyword in the message, e.g. \1 will become "this" from the message "YOURKEYWORD this is a test".
    \k
    replaced with the TextMark keyword requested, so you can serve multiple TextMarks with the same script, e.g. "MYKEYWORD".
    \a
    replaced with the action identifier, "REQ" for regular requests.
    \t
    time of request, in seconds since epoch (time_t format).
    \s
    hash digest of message, for verification. See Cryptographically Signed Requests.
  • The most common dynamic URL that captures the user's phone# and full request message is:
    http://yoursite.com/yourscript.php?user=\p&req=\0
    Your script would then access the request params "user" and "req". In PHP these are available as $_REQUEST['user'] and $_REQUEST['req'].
  • Multiple URLs may be provided in the url parameter by separating them with a space. When multiple URLs are provided, requests will be made in series, with the results concatenated.
  • See request_handler() for a description of various types of request handlers.

Resp:

JSON response.head.rescode==0 for success, or error code otherwise.
JSON-P callback: (as 'jsonp' param, optional) (blank for none)

HTTP:

POST http://help.api2.textmarks.com//TextMarkManager/set_dynamic_request_handler/

More:

This page documents a single API function set_dynamic_request_handler() within the TextMarkManager package of the TextMarks Text Message API.
You may use the interactive form above to invoke this function and observe its actual JSON response.

More resources: