🖥️
carter-js V3
  • carter-js
  • 💬Conversation
    • Say
    • Interactions
    • Opener
    • History
    • Speak
  • 🎱Skills
    • Basics
  • Other Features
    • Response Times
    • Personalise
  • More
    • Changelog
    • Further Reading
    • carter-py
Powered by GitBook
On this page
  • What is an interaction?
  • What does it look like?
  1. Conversation

Interactions

Carter Interactions are at the heart of carter-js

What is an interaction?

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.

What does it look like?

CarterInteraction {
  type: String
  id: String
  carterData: CarterData
  url: string
  ok: Boolean
  statusCode: Number
  statusMessage: String
  payload: CarterPayload
  triggeredSkills: CarterSkillInstance[]
  executedSkills: CarterSkillInstance[]
  timeTaken: Number
  isoTimestamp: String
  
  // These properties are extracted from carterData for convenience
  characterName: String
  outputText: String
  outputAudio: String
  forcedBehaviours: ForcedBehaviour[]
}

// For those unfamiliar with typescript, the something[] syntax 
// denotes an array of somethings
  • type: A string denoting which type of interaction this is. Eg "say", "opener", or "personalise"

  • 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.

  • url: The url the request was made to, for information and debugging purposes.

  • statusCode: The fetch response code.

  • statusMessage: A message related to the status code.

  • payload: The payload which was sent to Carter.

  • outputText: The response text, extracted from carterData

  • outputAudio: The response audio url if present, extracted from carterData

outputText and outputAudio 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

PreviousSayNextOpener

Last updated 2 years ago

carterData: 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 null.

ok: Returns true if the response code is 2xx. More details .

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.

💬
here
here
skills
skills