Interactions
Carter Interactions are at the heart of carter-js
Last updated
Carter Interactions are at the heart of carter-js
Last updated
An interaction is an object returned whenever you send a message to your Carter agent. It contains the data CarterAPI returns as well some some extra spice courtesy of carter-js.
id: This is a unique ID generated by carter-js
for each interaction. It is used to track the interaction through logging, and also for identifying interactions in the conversation history.
data: This is the data returned by the Carter API. To avoid replicating information, you can find an explanation of this data . In the event of an invalid response from the Carter endpoint, this property will be undefined.
ok: Returns true is the response code is 2xx. More details .
statusCode: An informational message relating to the status code.
payload: The payload object which was sent to Carter.
triggeredSkills: An array of that were triggered by Carter, but who's actions were not executed.
executedSkills: An array of that were triggered by Carter and who's actions were automatically executed on detection.
response_text: The response text, extracted from data
response_audio: The respons audio if present, extracted from data
response_text
and response_audio
are the recommended way to access the responses as these will remain the same regardless of API changes, helping to maintain backwards compatibility in your projects.
ok
and statusCode
are extracted straight from the fetch response
Both opener
and personalise
return modified versions of a CarterInteraction
without the skill arrays.