Skip to content

Forward messages into other conversations

POST
/chats/messages/forward
curl --request POST \
--url https://chat.work.optidata.cloud/api/chats/messages/forward \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "message_hashes": [ "55d32f0c-99c7-471d-b385-423b85701d38" ], "chat_ids": [ 12, 36 ] }'

Copies messages — text, images and files alike — into any combination of private conversations, groups and channels. Messages are identified by their hash, destinations by their numeric id; at most 50 of each.

Both ends are authorized: you can only forward from conversations you can read into conversations you could write in. Either check failing rejects the whole request, and nothing is copied anywhere — all destinations commit together or none does.

Media typeapplication/json
object
message_hashes
required

Hashes of the messages to forward. Duplicates are ignored.

Array<string>
<= 50 items
chat_ids
required

Numeric ids of the destination conversations. Duplicates are ignored.

Array<integer>
<= 50 items

The messages were copied into every destination.

Media typeapplication/json

Always an empty array.

Array
0
Examples
Exampleempty
[]

Missing, malformed or expired authentication key.

Media typeapplication/json

Authentication failures — and a few permission denials — use an error key rather than message.

object
error
required
string
Examples
Examplemissing

No bearer token sent

{
"error": "JWT passport exception: Missing bearer token in request"
}

The caller cannot read one of the source conversations, or cannot write in one of the destinations. Nothing was copied.

Media typeapplication/json

Authentication failures — and a few permission denials — use an error key rather than message.

object
error
required
string
Examples
Exampledenied
{
"error": "You don't have permission to create message this chat."
}

The request body or query string failed validation.

Media typeapplication/json
object
message
required

The first validation message.

string
errors
required

Validation messages keyed by field name.

object
key
additional properties
Array<string>
Examples
Exampleinvalid
{
"message": "The content field is required.",
"errors": {
"content": [
"The content field is required."
]
}
}

Rate limit exceeded. Retry after the window resets.

Media typeapplication/json

Generic error envelope used by policy, binding and framework failures.

object
message
required

Human-readable description of the failure.

string
Examples
Examplethrottled
{
"message": "Too Many Attempts."
}