Tasks

Create Task

Create a new task

post
/v1/task/create

Description

Create a new task with the given parameters.

Authorization

ChatBotKit API Secret * Required

HTTP Authorization Scheme: bearer

Request Body * Required

Request Body Schema: application/json

namestring

The associated name

descriptionstring

The associated description

metaobject

Meta data information

blueprintIdstring

The ID of the blueprint

contactIdstring

The contact associated with the task

botIdstring

The bot associated with the task

schedulestring

The schedule of the task. Cron expressions and date-based schedules are evaluated in the provided timezone when set.

timezonestring

An optional IANA timezone identifier used when evaluating the task schedule.

expiresAtnumber

An optional epoch-millisecond timestamp after which the task is automatically deleted. Pass null or omit for no expiry.

sessionDurationnumber

The session duration of the Widget integration

maxIterationsnumber

The maximum number of iterations per task execution

maxTimenumber

The maximum time per task execution in milliseconds

maxCallsnumber

The maximum number of tool calls across the whole task run (0 or null for unbounded)

import { ChatBotKit } from '@chatbotkit/sdk'

const cbk = new ChatBotKit({

secret: process.env.CHATBOTKIT_API_KEY!

})

const response = await cbk.task.create(

{
"name":"string",
"description":"string",
"meta":"object",
"blueprintId":"string",
"contactId":"string",
"botId":"string",
"schedule":"string",
"timezone":"string",
"expiresAt":"number",
"sessionDuration":"number",
"maxIterations":"number",
"maxTime":"number",
"maxCalls":"number"
}
)
{
"id":"string"
}
The task was created successfully