Real-time Triggers

Creating a Real-time trigger

Caravel provides a New Message Event real-time trigger that will fire once per message added to a feed. From the Automation form, choose Real-time, then add a New Message Event trigger and select the feed you wish to observe.

Creating HTTP actions

Caravel provides HTTP actions that you can use in response to a real-time automation trigger. All actions receive the action payload (👇 more on this below) for use in the request body. Caravel uses Handlebars templating to add dynamic content to your HTTP actions.

Defining an Action Payload

"feed": "{{feedName}}",
"text": "{{{message.text}}}",
"mentioned": "{{message.mentionedAt}}"

Example request body using handlebars templating with Caravel action payloads

Action Payloads use Handlebars templates. You can use triple braces to unescape text content {{{escapedText}}}

Action payloads

Each automation action receives a JSON payload with the following properties:

message object

The message that triggered this automation, it has the following properties:

text string The text of the message

sentiment string The predicted sentiment of the message (Very Negative, Negative, Neutral, Positive, Very Positive)

sentimentScore number Numerical value of sentiment between -1 and 1. -1 is most negative and 1 is most positive.

aspectSentiments { name: string; sentiment: string }[] Array of objects containing the classification name and sentiment score (-1 to 1)

categories string[] List of category classifier names that matched this message

intents string[] List of intent classifier names that matched this message

topics string[] List of topic classifier names that matched this message

actor string | null Name of person who wrote this message

externalUserId string | null The external identifier of the customer from the message source

originName string | null Name of message origin

originUrl string | null URL of message origin

conversationUrl string URL link to message in your Caravel workspace

sourceName string Name of Caravel source

conversationUrl string URL link to message in your Caravel workspace

id string Caravel message identifier

conversationId string Caravel conversation identifier this message belongs to

externalId string | null The external identifier for this message

mentionedAt string When this message first appeared (defaults to createdAt if originCreatedAt doesn't exist)

createdAt Date Caravel internal timestampconversationUrl string URL link to message in your Caravel workspace

updatedAt Date Caravel internal timestamp

originCreatedAt Date | null Timestamp from external origin

automationName string

Name of the automation currently running.

feedName string

Name of the feed this automation is running on.

logs { level: 'info' | 'error'; message: string; timestamp: number }[]

An array of automation logs for debugging.

Example HTTP Actions