VK icon

VK

Работа с API ВКонтакте (личная страница)

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

AI-generated

Summary

Send a private message via VK to a user or chat by specifying the recipient's ID or Peer ID, along with the message text and optional attachments.

Inputs

  • dataSource — Choose the source for the recipient's ID: from incoming data or manual input.
  • userIdField — Specify the JSON field name from incoming data that contains the User ID (used if dataSource is 'input').
  • userId — Manually enter the recipient's User ID; ignored if Peer ID is specified.
  • peerId — Enter the Peer ID for a chat (2000000000 + chat_id). If provided, userId is ignored.
  • message (required) — Set the text content of the message to send.
  • attachment — Provide comma-separated VK attachment strings to include (e.g., photos, documents).
  • replyTo — Specify the message ID to reply to; 0 means no reply.
  • dontParseLinks — When true, disables link previews in the sent message.

Output shape

a single JSON object

Returns an object containing the sent message ID, peer ID used, and a status field indicating success ('sent'). The message_id is a number representing the created message.

Examples

Example 1: Send a message manually specifying the user ID with message text

Set 'Источник данных' to 'Вручную', provide 'ID получателя' and 'Текст сообщения' parameters, optionally attachments, replyTo, and dontParseLinks.

Example 2: Send messages dynamically using user IDs from incoming data

Set 'Источник данных' to 'Из входных данных', specify the 'Поле с User ID' that contains the recipient IDs in incoming items, and set the message text and other optional parameters.

Links

Discussion