Skip to main content
In Cognigy.AI 2025.25.0, transformers will start using the axios library for handling HTTP requests internally instead of request-promise. This change occurs to improve security and maintainability. The following HTTP request options will still be supported:
  • URL configurationuri, url
  • Request methodmethod
  • Request headers and configurationheaders
  • Request bodyform, json
  • Query parametersqs, qsStringifyOptions
  • Authenticationauth
  • Connection and networkproxy, maxRedirects, gzip, encoding
If you use other HTTP request options, review your transformer code to ensure it is compatible with the axios library before the release of Cognigy.AI 2025.25.0.
The Inject Transformer converts the webhook payload from an external service before you call an Inject API request, which sends the data to the Flow. With the inject transformer, you don’t need a service that translates the webhook payload of the external service into the correct format for the Inject API request. You can handle this conversion in the inject transformer by parsing the payload to return only the necessary values. You can configure the inject transformer in the handleInject function in the Endpoint settings or via CLI.

Restrictions

  • The inject transformer is supported only for webhook- and socket-based Endpoints.
  • The return value is validated against a set of rules. If these rules aren’t met, the transformer throws an error. The following rules apply:
    • userId is a string with up to 256 characters.
    • sessionId is a string with up to 256 characters.
    • text is a string with up to 10,000 characters.
    • data is an object.

Transformer Function Arguments

The following table shows an overview of the function arguments:

Endpoint Configuration Object

Return Values

The inject transformer returns a valid user ID, session ID, text, and data. These return values need to match the format of the payload of the Endpoint you are using. The payload format is specific to the Endpoint type you use, for example, Alexa or Facebook (Meta) Messenger. Read the documentation of the specific Endpoint to know how to format the payload. If the inject transformer returns a falsy value, the output is discarded and not sent to the Inject API request. Here is an example of the correct return format for a webhook-based Endpoint:
Last modified on April 27, 2026