sendMessage

fun sendMessage(str: String, contactKey: String = "0", replyId: Int? = null)(source)

Sends a message to a contact or channel.

If the message is a direct message (no channel specified), this function will:

  • If the device firmware version is older than 2.7.12, it will mark the destination node as a favorite to prevent it from being removed from the on-device node database.

  • If the device firmware version is 2.7.12 or newer, it will send a shared contact to the destination node.

Parameters

str

The message content.

contactKey

The unique contact key, which is a combination of channel (optional) and node ID. Defaults to broadcasting on channel 0.

replyId

The ID of the message this is a reply to, if any.