Templates for HTTP POST Carriers

Top  Previous  Next

NOTE: When referencing any non-printable character, such as a line feed, carriage return, horizontal tab or similar, you must use the ASCII code for that character and it must be prefixed by a backslash (\).

 

Templates for HTTP POST carriers tell PageGate how to interact with and structure data passed to a web form, Web API or REST API.

 

It's important to gather as much information as you can about what API or webform you're interacting with and their documentation will typically provide required variables and how they need to be implemented.

 

Conceptually, the 'Settings' section of a POST carrier template tells PageGate if the API requires any special interaction and the 'Text' section determines what variables to declare and how to structure the message body.

 

These values can be used in the 'Settings' section of an HTTP POST carrier:

 

Variable

Possible Values

Example Statement

Description

ResponseRecipient

Recipient

 

Group

ResponseRecipient = A recipient or group's name as it exists in the PG Admin

When the HTTP GET or POST transaction completes, the specified recipient or group will receive any responses from the receiving API/web host. For more information, please see the Two Way Messaging section of the documentation.

HttpPostType

HeadBody
or
UrlHeadBody

HttpPostType = HeadBody

 

HttpPostType = UrlHeadBody

HttpPostType = HeadBody configures an HTTP POST carrier to provide header information followed by structured data, usually JSON or XML, in the body.

 

HttpPostType = UrlHeadBody configures an HTTP POST carrier to pass parameters in the URL, more like the GET method. This is not a typical use of HTTP POST but is used/required by some APIs.

HttpSuccessResponse

Text

See Description

This variable tells PageGate to scan any responses back from a GET or POST request for the required keywords or keyphrases. If those keywords or keyphrases are found, the message is treated as successfully delivered.

 

This variable is both case and punctuation sensitive and PageGate will look for an exact match to what you enter.

 

Multiple search terms may be used and you'll need to separate each item with a pipe.

 

For example, this would only scan for the word success:

HttpSuccessResponse = success

 

This would scan for the word success in the <Reply> tag:

HttpSuccessResponse = <Reply>success</Reply>

 

This would scan for the word success in the <Reply> tag OR the word hijinks:

HttpSuccessResponse = <Reply>success</Reply>|hijinks

 

This would scan for the word success OR the word hijinks OR the word actualization:

HttpSuccessResponse = success|hijinks|actualization

 

If this variable is included, any response to a GET/POST request that doesn't include the search term(s) will be treated as a failure.

HttpErrorResponse

Text

From = CAD

This variable overrides the value passed to PageGate by the input modules/APIs. By specifying this variable, you're telling PageGate to use a single, standardized sender's name for all traffic controlled by this template.

From

Text

From = CAD

This variable overrides the value passed to PageGate by the input modules/APIs. By specifying this variable, you're telling PageGate to use a single, standardized sender's name for all traffic controlled by this template.

To

Text

To = 7818290500

This variable overrides the ID/PIN or Email values. By specifying this variable, you're telling PageGate to send all traffic processed by this template to the specified ID or Email address instead.

 

 

This is how to use the 'Text' section of an HTTP POST carrier:

Each value you specify will need to correspond to a variable that the receiving API will recognize. For example, let's say we wanted to send a message using Twilio's API. We know they're looking  that looked for to, from and body as variables. We would need to format the text template as follows:

 

|to|%RecipientId%|

|from|%Sender%|

|body|%Message%|

 

NOTE:  | is a pipe character and is found on most keyboards above the backslash character, \.

 

Some APIs, like MessageBird, require an authentication variable in the body of the POST and those are declared like any other variable.

 

Example:

|Authorization|AccessKey PasteYourAccessKeyHere|

 

|recipients|%RecipientId%|

|originator|%Sender%|

|body|%Message%|