Interactions

carter-js contains an interaction class which is used to store the result of every interaction with your character, which contains the following properties:

type: string
id: string
payload: dictionary
time_taken: number
timestamp: ISO compliant string
url: string
ok: boolean
status_code: number
status_message: string

# If interaction was successful and carter_data is returned
output_text: string
output_audio: string
forced_behaviours: list
  • type - the type of interaction IE. say

  • id - A uuid to identify the interaction

  • payload - A dictionary containing the data carter-py sent to your character

  • time-taken - The total time from calling the function to creating the interaction

  • timestamp - An ISO compliant string representing when the interaction was completed

  • url - The url the request was made to

  • ok - A boolean, taken from the response object, see here.

  • status_code - The response status code, see here.

  • status_message - The status message related to the code, see here.

The following properties will only be set on an successful interaction, when carter responds to your message. All properties will be set to None if they are not applicable/not present, so it's always worth checking interaction.ok is True. If the response is successful, there should be output data.

  • output_text - The message returned by your character

  • output_audio - The output audio url returned by carter, depending on your use of speak, see the carter-py section, and sections for individual functions for more guidance.

  • forced_behaviours - This is a list of forced behaviours triggered by your character. Will not be present for opener and personalise interactions.

Interactions have an interaction.print_verbose() function for debugging purposes.

Last updated