4.18j

TextMarks API V2 - AutoDoc: TextMarkManager / set_webscrape_request_handler()

Method: set_webscrape_request_handler() (POST) - Configure web-scraping 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 URL Dynamic script URL (to call on each request)
REQ clip_left String Text immediately prior to area of interest
OPT api_key API Key API Key (Register here)
OPT notify_sms Bool (0/1) Notify manager (by SMS) when requested
OPT clip_right String Text immediately after area of interest
OPT clip_left_inc Bool (0/1) Include clip_left in clipping? (default 0)
OPT clip_right_inc Bool (0/1) Include clip_right in clipping? (default 0)
OPT clip_after String Skip all content prior to this text

Test:


Docs:

  • Set TextMark such that when somebody texts the keyword tm to 41411, TextMarks servers will make a public web request to get content from a web site (optionally passing along request data as query params), find a specific piece of data, strip out HTML, and respond to the user with SMS.
  • The clipping arguments define what part of the web page you are interested in.
  • The web site should complete its response 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.
  • For example, if a weather page URL looks like:
    http://somesite.com/somepage.php?zip=90048
    then you might use this URL to allow users to request weather for a specific zip code by writing it immediately after the keyword in their SMS message:
    http://somesite.com/somepage.php?zip=\1
  • See request_handler() for a description of various types of request handlers. For standard API request/response interactions, you probably would be most interested in set_dynamic_request_handler().

Resp:

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

HTTP:

POST https://api2ssl.textmarks.com//TextMarkManager/set_webscrape_request_handler/

More:

This page documents a single API function set_webscrape_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: