handleInput function in the Endpoint settings or via CLI.
Restrictions
-
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:
userIdis a string with up to 256 characters.sessionIdis a string with up to 256 characters.textis a string with up to 10,000 characters.datais an object.
Transformer Function Arguments
Depending on the Endpoint type in which you want to use the transformer, the function arguments vary:- Webhook- and REST-based Endpoints
- Socket-based Endpoints
Endpoint Configuration Object
endpoint Object Properties
endpoint Object Properties
Return Values
The input transformer returns the user ID, session ID, text, and data, which are subsequently sent to the Flow. These values are extracted from the Endpoint payload. 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.Example of Transformer Return Values
Example of Transformer Return Values
Undefined Return Values
If the transformer returnsundefined for userId, sessionId, text, or data, this means that the transformer uses the value from the Endpoint.
Example of Undefined Return Values
Example of Undefined Return Values
The following example overwrites
text and data, but uses the userId and sessionId from the Endpoint:Endpoints Event Messages
The Webchat and the Socket.IO Endpoints output event messages that indicate user activity, such as whether the user is connected (user-connected) or disconnected (user-disconnected). These event messages neither trigger Flows nor are counted. The event messages inform handover providers about user activity, allowing human agents to determine if the user is still engaged in the conversation. You can access the event messages with the data._cognigy.event property in the return value of the input transformer.
Example of Return Values with Event Messages
Example of Return Values with Event Messages
Example of Input Transformer with Event Messages
Example of Input Transformer with Event Messages