Skip to content

Web Get Requests

The ThinkAutomation public API URL also accepts HTTP GET requests. You can specify the message content as part of the URL. Whenever the URL is requested a new ThinkAutomation message will be created and processed.

The body, subject, from & to addresses can be specified on the query string:

https://api.thinkautomation.com/addmessage?taid=5f7b421a6e1f408c38488397179ab14c6e1f405c7cbf955cd9%2fwxO9qltjQwt0pU7d4GRErBl5njQP%2f
&from=alice%40test.com
&subject=unsubscribe
&body=testmessage

The body, subject, from and to query string parameters are optional.

You can add a &redirect={URL} parameter to the API URL query string if you want the server to respond with a 303 Redirect once the message has been accepted.

Passing Field/Value Pairs

You can also pass specific field values using x-fieldname=value. In this case the message passed to ThinkAutomation will be in Json format with each field value (excluding the 'x-').

For example:

https://api.thinkautomation.com/addmessage?taid=5f7b421a6e1f408c38488397179ab14c6e1f405c7cbf955cd9%2fwxO9qltjQwt0pU7d4GRErBl5njQP%2f
&from=alice%40test.com
&subject=unsubscribe
&x-name=Alice+Bamber
&x-email=alice%40test.com

The message body which would be sent to ThinkAutomation as:

{
    "name": "Alice Bamber",
    "email": "alice@test.com"
}

If you do not want to use field=value pairs you can pass the raw body text using the &body= query string parameter. The ThinkAutomation message body will be set to the contents of the body parameter with no conversion.

The RemoteHost, User-Agent & Origin headers will also be added to the ThinkAutomation message headers. You can access these values in your Automation using the Set Variable action with the Extract Header Value operation.

You can then use Extract Field actions to extract the data from the message and perform any other Automation actions. If your ThinkAutomation Server is not active when a web request is made it will be queued by the ThinkAutomation API for up to 48 hours.

Returning Automation Results

By default API GET requests will respond with a 202 Accepted status as soon as the message has been queued (unless a &redirect parameter is specified). You can optionally wait for the Automation results by adding &wait=true or &results=true query string parameter to the URL.

If &wait=true is used the API will return the results of the Automation in the MessageResultDetail object of the Json response along with a 200 OK status. The response will include the Automation return value.

If the &results=true parameter is used then only the Automation Return Value content (or an error message) will be returned along with a 200 OK status. Depending on the content of the Automation Return value, the result will be served as plain text (text/plain), HTML (text/html) or Json (application/json). If the Return Value contains Markdown text it will be converted to HTML first. If the Return Value is already HTML it will be returned as HTML. If the Return Value is Json it will be returned as Json.

If your Automation is long running, or you want to provide a static link to the Automation results that a user can access later, you can use the %Msg_ResultsUrl% variable. Your Automation could include this variable in an outgoing email. A user can click the link to view the Automation results at a later date. The %Msg_ResultsUrl% URL is unique for each processed message and contains a secure hash. The link will work for as long as the Message is stored in the Message Store.

See: Using The Web API