Forward messages into other conversations
const url = 'https://chat.work.optidata.cloud/api/chats/messages/forward';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"message_hashes":["55d32f0c-99c7-471d-b385-423b85701d38"],"chat_ids":[12,36]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
Hashes of the messages to forward. Duplicates are ignored.
Numeric ids of the destination conversations. Duplicates are ignored.
Responses
Section titled “ Responses ”The messages were copied into every destination.
Always an empty array.
Examples
[]Missing, malformed or expired authentication key.
Authentication failures — and a few permission denials — use an error
key rather than message.
object
Examples
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.
Authentication failures — and a few permission denials — use an error
key rather than message.
object
Examples
{ "error": "You don't have permission to create message this chat."}The request body or query string failed validation.
object
The first validation message.
Validation messages keyed by field name.
object
Examples
{ "message": "The content field is required.", "errors": { "content": [ "The content field is required." ] }}Rate limit exceeded. Retry after the window resets.
Generic error envelope used by policy, binding and framework failures.
object
Human-readable description of the failure.
Examples
{ "message": "Too Many Attempts."}