Http Extensions

A Http Extension is triggered by our Extension API which then can parse information from the API call. This information can be used to create or update recipients, and trigger certain communications to them. There isn’t a UI available in Agillic to view this Extension type.

Execution Method

The execution method for a Http Extension must be called execute, and is assumed to return a HttpResponse object, which consists of a statusCode and body. We map boolean and integer return values to a default HttpResponse object.

If the script does not return a value, returns something which is invalid, or throws an exception, we default to statusCode=400, with an empty body.

Here are a set of examples of acceptable response objects, starting with the default mapping from a boolean to the HttpResponse Object:

There are configurations that are available only for Http Extensions, to toggle between Secure/Open mode, and asynchronous mode. You can find the documentation of them here.

Writing Data

Due to the format of the execute function’s return values in Http Extensions, changes made on the recipients will only be completed if the return value has statusCode in the 2XX response range. This can be customized with the optional shouldSave function, which takes the execute function’s returned response object, determines if the extension should write the data or not, with a boolean response. If your execute function returned a boolean, we will map them to the default response object.

Here is an example replicating the default behavior of shouldSave:

Check out the helper recipientService, or the HTTP Extension Examples, for more context to this example.


The input arguments for Http Extensions are:

  • call: is unique to the extension type. It provides access to the data from the HTTP request which triggered it.
  • global: provides the access to global data (Global Data and Global Data Tables)

While the call input argument can be read similar to standard input arguments, it contains specific attributes:

Attribute Description Return Type Notes
path The request path after defined endpoint String See API Specifications to see information on path
method The http method used in the request String See API Specifications to see information on methods
body Body included in the request String If the body value is JSON, this can be converted to javascript types inside the extension by parsing JSON.parse(call.body)
params Any query parameters included in the request Object of Strings Multiple values of same key not supported, so a call with params ?p1=v1&p1=v2 results in undefined behavior
headers Any header included in the request Object of Strings See API Specifications to see information on headers

Http Extensions do not require preloading, because the RecipientService helper provides fully pre-loaded recipients when a query is made.