Templates for HTTP POST Carriers

Top  Previous  Next

Templates for HTTP POST carriers tell PageGate how to interact and how to 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

Description

BodyMaxChars

Numeric

Example: BodyMaxChars = 200

 

This parameter limits the length of the %Message% macro and does not override the carrier "Max Chars" setting.

Filter

File path to and file name of the filter to run

Note: pgfilter.exe and pgfilter.dll must reside in the PageGate program directory to use this parameter.

 

Example:  Filter = c:\PageGateData\Filters\yourcarrierfilter.xml

 

This parameter calls on PageGate's filtering system when sending and receiving SMS through this carrier. This allows for the sorting and modification of both outbound messages and replies and is an integral part of two-way messaging.

FilterDebugFile

File path to and file name of the log to write

Example: FilterDebugFile = c:\PageGateData\Filters\outboundfilter1.log

 

When using a filter, you can use this variable to output this specific filter's log to the specific location and file name.

From

Text

Example: From = CAD

 

This parameter 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.

HttpErrorResponse

Command String

See Description

NOTE: This parameter's routine only engages when receiving a 200 class response from the web server.

 

This variable tells PageGate to scan for the specified keywords or keyphrases in responses to a POST requests made by this carrier. If those keywords or keyphrases are found, the message is treated as failed or rejected, depending on what you specify.

 

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 must be separated by a pipe.

 

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

HttpErrorResponse = failed

 

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

HttpErrorResponse = <Reply>failed</Reply>

 

This would scan for the word reject or the word failed in the <Reply> tag:

HttpErrorResponse = reject|<Reply>failed</Reply>

 

This would scan for the word failed OR the word reject OR the phrase object not found:

HttpErrorResponse = failed|reject|object not found

 

Any response from the web server that includes the search term(s) will be treated as a failure.

HttpPostType

HeadBody
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 POST method. This is not a typical use of HTTP POST but is used/required by some APIs.

HttpProtocol

HTTPS

HTTP

Example: HttpProtocol = HTTPS

 

This parameter forces the use of HTTPS or HTTP regardless of the port used to connect.

HttpResponseTimeout

Milliseconds

Example: HttpResponseTimeout = 1000

 

This variable forces PageGate to wait for the specified number of milliseconds (1000 = 1 second) for a response to the HTTP communication request.

HttpSuccessResponse

Command String

See Description

NOTE: This parameter's routine only engages when receiving a 200 class response from the web server.

 

This variable tells PageGate to scan for the specified keywords or keyphrases in responses to a POST requests made by this carrier. If those keywords or keyphrases are found, the message is treated as failed or rejected, depending on what you specify.

 

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 must be separated by a pipe.

 

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

HttpSuccessResponse = success

 

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

HttpSuccessResponse = <Reply>Acknowledged</Reply>

 

This would scan for the word hijinks or the word Acknowledged in the <Reply> tag:

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

 

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

HttpSuccessResponse = success|hijinks|actualization

 

Any response from the web server that includes the search term(s) will be treated as a success.

InterMessageDelay

Milliseconds

Example: InterMessageDelay = 1000

 

This variable inserts a pause, in milliseconds, in between each message that is delivered. It could be possible for PageGate to send a large number of data requests too quickly and this prevents that from happening.

ParameterDelimiter

See Description

Example: ParameterDelimiter = !

 

Message templates for HTTP POST carriers usually involve parameter + variable pairs that are declared in this format:

|parameter|variable|

 

ParameterDelimiter allows you to change the 'wrapping' character from a pipe (|) to something else, like an exclamation mark (!).

ResponseIncludeRequest

True

False

Example: ResponseIncludeRequest = True

 

Setting this parameter to true tells PageGate to include the original request sent to the API when recording responses.

ResponsePath

File Path

Example: ResponsePath = c:\PageGateData\APIResponses\

 

This parameter allows you to specify the folder that responses should be written to. If API responses do not need to be tracked, this parameter is not required.

ResponseRecipient

Recipient

 

Group

Example: ResponseRecipient = groupname

 

When the HTTP 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.

StripAlpha

True

False

Example: StripAlpha = True

 

Setting this value to true will remove any alphabetical character from messages delivered through this carrier. For example, if you tried to send the message 'Alert on node 127.0.0.1', the only thing delivered would be '127.0.0.1'

StripCharacters

See description

Example: StripCharacters = |\~

 

This parameter will remove all instance of any character(s) entered. In the above example, that would strip out all pipes (|), backslashes (\) and tildes (~).

StripNonPrintable

True

False

Example: StripNonPrintable = True

 

Settings this value to true will remove any non-printable ASCII characters, like carriage returns, line feeds, horizontal tabs and similar, from messages delivered through this carrier.

To

Text

Example: 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.

UseFilterDll

True

False

Note: pgfilter.exe and pgfilter.dll must reside in the PageGate program directory to use this parameter.

 

Example: UseFilterDll = True

 

Setting this parameter to true tells PageGate to use the filter dll, which is a more efficient method of running the filter.

 

 

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%|