Chats

Send a chat message with attached files

Posts a message into a chat and uploads its attachments in the same request, as multipart/form-data. Every participant in the chat receives it.

Ask for an upload session at POST /company-app/chats/{chatId}/messages/upload-sessions, then send the message as JSON with uploadSessionIds.
POST
https://api.portal.magicdoor.com/company-app/chats/{chatId}/messages

Authorization

Authorizationstringrequired
Bearer token — Send your API token in the Authorization header as Bearer <token>. Requests without a valid token are rejected with 401 Unauthorized.

Path parameters

chatIdstringrequired

The chat to post into.

example: 1830472847398404096

Body

multipart/form-data

Form parts. files may repeat, once per file.

messagestring

The message text.

filesfile[]

The files to attach. Repeat the part once per file. Empty files are skipped.

sendTextboolean

Also send the message as an SMS to every participant with a phone number.

default: false
sendEmailboolean

Also send the message as an email to every participant with an email address.

default: false
aiEnhancedboolean

Record that the text came from the AI suggestion endpoint.

default: false

Response

200 · The message was posted. The response has no body — use the JSON form if you need the message back.

401 · The access token is missing, expired, or not valid.

404 · No chat with that id belongs to your company.

422 · The company has all outbound communications switched off, so no message was recorded and nothing was sent.

This delivers a message to a real person

The message is added to the chat, where its participants see it. If you set sendText it is also sent as an SMS to every participant's phone; if you set sendEmail it is also emailed to them. On a lease or group chat that is every participant, not one person.

This endpoint and the JSON one share a URL. MagicDoor picks between them on the request's Content-Type: send multipart/form-data to reach this one.