MAX icon

MAX

Отправка сообщений и работа с API мессенджера MAX

Сообщение → Отправить с медиа

AI-generated

Summary

Send a MAX messenger message with media attachments (image, video, audio, file) to a user or chat, either by uploading n8n binary files to MAX or by reusing already-uploaded attachment tokens. Optionally adds a caption, inline buttons, and send options.

Inputs

  • userId (required) — Recipient ID. A value starting with '-' is sent as chat_id (group/channel); otherwise as user_id.
  • mediaSource — 'binary' (default) uploads files from n8n binary properties; 'json' uses a ready-made attachments array with no upload.
  • binaryPropertyName (required) — Shown when source is binary. Comma-separated binary property names (e.g. data, data1) to send several files in one message. Default 'data'.
  • attachmentsJson (required) — Shown when source is JSON. Array of MAX attachment objects like {type, payload:{token}}. It must parse to an array or the item errors. Types listed: image, video, audio, file, share, location, contact.
  • caption — Text sent as the message body alongside the media. Empty by default.
  • addButtons — Enable inline keyboard buttons on the message.
  • buttonMode — 'simple' (visual rows of buttons) or 'json'. Shown when buttons are enabled.
  • buttons — Simple mode: rows of buttons. Each button has text and a type: callback (payload), link (url), message (payload), request_contact, or request_geo_location.
  • inlineKeyboard — JSON mode: array of button rows, used directly as the keyboard buttons. Invalid JSON will throw.
  • additionalOptions — Optional text format (markdown/html), reply-to message ID, disable link preview, and silent message (sent as notify=false).

Output shape

One output item per input item, containing the JSON response from the MAX POST /messages call (the created message).

In binary mode each file's type is picked from its MIME type (image, video, audio; anything else is 'file'; image if no MIME type). Each file goes through a two-step MAX upload to get a token. The send step retries up to 5 times with increasing delays if MAX reports the attachment is not ready. If a file has no binary data, the upload fails, or no token is returned, the item errors. With Continue On Fail enabled, the output is {error: message} instead.

Examples

Example 1: Send a photo downloaded by an earlier HTTP Request node, with a caption

userId=12345, mediaSource=binary, binaryPropertyName=data, caption='Report ready'

Example 2: Send several files in one message to a group chat

userId=-70931657203722, mediaSource=binary, binaryPropertyName='data, data1, data2'

Example 3: Resend an already-uploaded image with a link button

mediaSource=json, attachmentsJson=[{"type":"image","payload":{"token":"..."}}], addButtons=true, buttonMode=simple, one button of type link with a URL

Links

Discussion