Help us improve our product documentation on docs.cognigy.com by sharing your thoughts in a quick survey. Your feedback shapes the future of our content!
Help us improve our product documentation on docs.cognigy.com by sharing your thoughts in a quick survey. Your feedback shapes the future of our 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 configuration — uri, url
Request method — method
Request headers and configuration — headers
Request body — form, json
Query parameters — qs, qsStringifyOptions
Authentication — auth
Connection and network — proxy, 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.
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:
handleInject: async ({ endpoint, request, response }) => { const webhookPayload = request.body; // Parse the webhook payload and extract necessary data const userId = webhookPayload.user.id; const sessionId = webhookPayload.session.id; const text = webhookPayload.message.text; const data = { source: webhookPayload.source, timestamp: webhookPayload.timestamp }; return { userId, sessionId, text, data };}