🖥️
carter-js V4
  • carter-js
  • 💬Conversation
    • Say
    • Interactions
    • Opener
    • History
    • Speak
  • 🎱Skills
    • Basics
  • Other Features
    • Response Times
    • Personalise
    • Context
  • More
    • Changelog
    • Further Reading
    • carter-py
Powered by GitBook
On this page
  • Context
  • Interactions
  • Audio
  1. Conversation

Say

Easily speak to your carter character

Previouscarter-jsNextInteractions

Last updated 1 year ago

You can speak to your carter agent using Carter.say(). Carter.say() returns a CarterInteraction.

// Assuming you have already created a Carter object called carter

// Send a message to your Carter agent
const interaction = await carter.say("Hello", 'your-user-id', 'context', speak=True) // Only the message is mandatory
if (interaction.ok) {
  const replyMessage = interaction.outputText
}

say() takes in your message and an optional userId. carter-js will generate an id for you if you do not provide one. This will be different each time but can be extracted from the interaction object. speak is discussed in the Speak section.

Context

Context is an optional parameter which allows you to provide useful contextual information to the agent outside of the actual message. See the for more info on that and take a look at the Context page for the full endpoint.

HINT: You can have you agent start a conversation related to anything you like by calling carter.say() with an empty ('') - not undefined - string and some context.

Interactions

Carter interactions are discussed more in the next section, however please be aware that if Carter does not return a valid response then the carterData and outputText/outputAudio properties of the interaction will be null.

Audio

You can pass a base 64 encoded audio string in in place of a text input by calling carter.sayAudio() instead. Everything else works the same, just replace textwith your audio string instead.

💬
carter docs