curl --request POST \
--url https://api.botpress.cloud/v1/chat/messages/get-or-create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-bot-id: <x-bot-id>' \
--data '
{
"userId": "<string>",
"conversationId": "<string>",
"type": "<string>",
"tags": {},
"payload": {},
"schedule": {
"dateTime": "<string>",
"delay": 123
},
"origin": "synthetic",
"discriminateByTags": [
"<string>"
]
}
'{
"message": {
"id": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"type": "<string>",
"payload": {},
"direction": "incoming",
"userId": "<string>",
"conversationId": "<string>",
"tags": {},
"origin": "synthetic"
},
"meta": {
"created": true
}
}Retrieves the Message object for given discriminating tags. If the message does not exist, it will be created. If the message already exists, its tags and payload will be updated with the provided values if they are defined.
curl --request POST \
--url https://api.botpress.cloud/v1/chat/messages/get-or-create \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-bot-id: <x-bot-id>' \
--data '
{
"userId": "<string>",
"conversationId": "<string>",
"type": "<string>",
"tags": {},
"payload": {},
"schedule": {
"dateTime": "<string>",
"delay": 123
},
"origin": "synthetic",
"discriminateByTags": [
"<string>"
]
}
'{
"message": {
"id": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"type": "<string>",
"payload": {},
"direction": "incoming",
"userId": "<string>",
"conversationId": "<string>",
"tags": {},
"origin": "synthetic"
},
"meta": {
"created": true
}
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Bot id
Integration id
Integration alias
Message data
ID of the Conversation
28 - 36Payload is the content type of the message. Accepted payload options: Text, Image, Choice, Dropdown, Card, Carousel, File, Audio, Video, Location
Schedule the Message to be sent at a specific time. Either dateTime or delay must be provided.
Show child attributes
synthetic Optional list of tag names to use for strict matching when looking up existing messages. If provided, all specified tags must match exactly for a message to be considered a match. For example, with an existing message whose tags are {"foo": "a", "bar": "b", baz: "c"}: Without this parameter, ALL tags must match exactly. With ["bar","baz"], all listed tags must match their values, and other tags are not considered.
500Was this page helpful?