Skip to main content

Overview

Osmium Chat Protocol provides operations to modify existing messages, remove them, and forward messages to other chats. These operations require appropriate permissions in the target chat.

Edit Message

The EditMessage request allows you to modify the content, media, and entities of an existing message.

Proto Definition

// messages.editMessage -> ()
message EditMessage {
  refs.ChatRef chat_ref = 1;
  fixed64 message_id = 2;  // @snowflake<Message>
  optional string message = 3;
  bool remove_media = 4;
  repeated media.MediaRef media = 5;  // Replaces media
  repeated types.MessageEntity entities = 6;  // Replaces entities if not empty or if message is set
}

Request Fields

chat_ref
ChatRef
required
The chat containing the message to edit. Must match the original message’s chat.
message_id
fixed64
required
The ID of the message to edit. Must be a message you authored (unless you have moderator permissions).Type: Snowflake ID representing a Message
message
string
The new text content for the message. If provided, replaces the existing message text.Leave unset to keep the existing message text unchanged.
remove_media
bool
default:"false"
Set to true to remove all media attachments from the message.If false and media is provided, the media array replaces existing attachments.
media
MediaRef[]
New media attachments that replace the existing media (unless remove_media is true).If empty and remove_media is false, existing media is preserved.
entities
MessageEntity[]
New formatting entities. Replaces existing entities if:
  • The array is not empty, OR
  • The message field is set
If both conditions are false, existing entities are preserved.

Examples

Edit Message Text Only

{
  "chat_ref": {
    "user": {
      "user_id": "123456789012345678"
    }
  },
  "message_id": "555555555555555555",
  "message": "Updated message text"
}

Remove All Media

{
  "chat_ref": {
    "channel": {
      "community_id": "987654321098765432",
      "channel_id": "111111111111111111"
    }
  },
  "message_id": "555555555555555555",
  "remove_media": true
}

Edit Text and Update Formatting

{
  "chat_ref": {
    "group": {
      "group_id": "222222222222222222"
    }
  },
  "message_id": "555555555555555555",
  "message": "Important update",
  "entities": [
    {
      "start_index": 0,
      "length": 9,
      "bold": true
    }
  ]
}

Delete Message

The DeleteMessage request permanently removes one or more messages from a chat.

Proto Definition

// messages.deleteMessage -> ()
message DeleteMessage {
  refs.ChatRef chat_ref = 1;
  repeated fixed64 message_ids = 2;  // @snowflake<Message>
}

Request Fields

chat_ref
ChatRef
required
The chat containing the messages to delete.
message_ids
fixed64[]
required
Array of message IDs to delete. You can delete multiple messages in a single request.Type: Array of Snowflake IDs representing MessagesYou must have permission to delete these messages (either as the author or with moderator permissions).

Examples

Delete a Single Message

{
  "chat_ref": {
    "user": {
      "user_id": "123456789012345678"
    }
  },
  "message_ids": ["555555555555555555"]
}

Delete Multiple Messages

{
  "chat_ref": {
    "channel": {
      "community_id": "987654321098765432",
      "channel_id": "111111111111111111"
    }
  },
  "message_ids": [
    "555555555555555555",
    "666666666666666666",
    "777777777777777777"
  ]
}

Forward Message

The ForwardMessage request copies one or more messages from one chat to another, preserving the original content and author information.

Proto Definition

// messages.forwardMessage -> ()
message ForwardMessage {
  refs.ChatRef chat_ref = 1;
  refs.ChatRef from = 2;
  repeated fixed64 message_ids = 3;  // @snowflake<Message>
}

Request Fields

chat_ref
ChatRef
required
The destination chat where messages will be forwarded to.
from
ChatRef
required
The source chat where the messages are currently located.
message_ids
fixed64[]
required
Array of message IDs to forward from the source chat to the destination chat.Type: Array of Snowflake IDs representing MessagesMessages will be forwarded in the same order as specified.

Examples

Forward a Single Message to Another User

{
  "chat_ref": {
    "user": {
      "user_id": "999999999999999999"
    }
  },
  "from": {
    "user": {
      "user_id": "123456789012345678"
    }
  },
  "message_ids": ["555555555555555555"]
}

Forward Multiple Messages to a Channel

{
  "chat_ref": {
    "channel": {
      "community_id": "987654321098765432",
      "channel_id": "111111111111111111"
    }
  },
  "from": {
    "group": {
      "group_id": "222222222222222222"
    }
  },
  "message_ids": [
    "555555555555555555",
    "666666666666666666"
  ]
}

Forward to Saved Messages

{
  "chat_ref": {
    "self": {}
  },
  "from": {
    "channel": {
      "community_id": "987654321098765432",
      "channel_id": "111111111111111111"
    }
  },
  "message_ids": ["555555555555555555"]
}

Notes

Edit Message

  • Edited messages display an “edited” indicator with the edit timestamp
  • You can only edit messages you authored (unless you have moderator permissions)
  • Setting message will update the text and reset entities unless new entities are provided
  • Media replacement is all-or-nothing; use remove_media to clear attachments

Delete Message

  • Deletions are permanent and cannot be undone
  • You can delete your own messages or messages in chats where you have delete permissions
  • Deleted messages are removed for all participants
  • Bulk deletion is supported for moderation purposes

Forward Message

  • Forwarded messages retain their original author attribution
  • The forward field in the message indicates it was forwarded
  • You must have permission to read messages in the source chat and send messages in the destination chat
  • Media attachments are preserved in forwarded messages

Build docs developers (and LLMs) love