Skip to contents

Sends a direct message to an existing chat room using the SendChatMessage RPC.

Usage

send_chat_message(client, room_id, text = NULL, media_id = NULL)

Arguments

client

A mixi2_client object created by mixi2_client().

room_id

ID of the chat room to send the message to.

text

Message text. Either text or media_id must be provided.

media_id

ID of a media attachment (from upload_media()). Either text or media_id must be provided.

Value

A list representing the sent ChatMessage object.

Details

The application can only reply to an existing conversation; it cannot initiate a new DM. The room_id is available in chat message events received via Webhook.

Examples

if (FALSE) { # \dontrun{
client <- mixi2_client()

# Reply with text
send_chat_message(client, room_id = "room_123", text = "Hello!")

# Reply with media
media_id <- upload_media(client, "image.jpg")
send_chat_message(client, room_id = "room_123", media_id = media_id)
} # }