botruntime
API ReferenceChat API

Set State

Overrides the [State](#schema_state) object by setting the values of the parameters passed.

POST
/v1/chat/states/{type}/{id}/{name}

Path Parameters

type*string

Represents the resource type that the state is related to

Value in

  • "conversation"
  • "user"
  • "bot"
  • "integration"
  • "workflow"
id*string

Id of the State which will be either the botId, the userId or the conversationId

name*string

Name of the State which is declared inside the bot definition

Header Parameters

x-bot-id*string

Bot id

x-integration-id?string

Integration id

x-integration-alias?string

Integration alias

Request Body

application/json

State content

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

curl -X POST "https://example.com/v1/chat/states/conversation/string/string" \  -H "x-bot-id: string" \  -H "Content-Type: application/json" \  -d '{    "payload": {}  }'
{  "state": {    "id": "stringstringstringstringstri",    "createdAt": "2019-08-24T14:15:22Z",    "updatedAt": "2019-08-24T14:15:22Z",    "botId": "stringstringstringstringstri",    "conversationId": "stringstringstringstringstri",    "userId": "stringstringstringstringstri",    "name": "string",    "type": "conversation",    "payload": {},    "expiry": 1,    "expiresAt": "2019-08-24T14:15:22Z"  }}
{  "state": {    "id": "stringstringstringstringstri",    "createdAt": "2019-08-24T14:15:22Z",    "updatedAt": "2019-08-24T14:15:22Z",    "botId": "stringstringstringstringstri",    "conversationId": "stringstringstringstringstri",    "userId": "stringstringstringstringstri",    "name": "string",    "type": "conversation",    "payload": {},    "expiry": 1,    "expiresAt": "2019-08-24T14:15:22Z"  }}