AI Integration Quick Reference
AI Integration Quick Reference
deletedAt (timestamp), deletedBy (user who deleted)- Adding a listener for real-time deletes when your app is running
- Fetching missed deletes when your app was offline
Delete a Message
UsedeleteMessage() with the message ID.
- JavaScript
- TypeScript
- Async/Await
deletedAt (timestamp) and deletedBy (UID of deleter) fields set.
The deleteMessage() method returns a BaseMessage object. Access the response data using getter methods:
| Field | Getter | Return Type | Description |
|---|---|---|---|
| id | getId() | number | Unique message ID |
| sender | getSender() | User | The user who sent the message |
| deletedAt | getDeletedAt() | number | Timestamp when the message was deleted |
| deletedBy | getDeletedBy() | string | UID of the user who deleted the message |
| User Role | Conversation Type | Deletion Capabilities |
|---|---|---|
| Message Sender | One-on-One Conversation | Messages they have sent. |
| Message Sender | Group Conversation | Messages they have sent. |
| Group Admin | Group Conversation | All the messages in the group. |
| Group Moderator | Group Conversation | All the messages in the group. |
Real-time Message Delete Events
UseonMessageDeleted in MessageListener to receive real-time delete events.
- Message Listener
- TypeScript
onMessageDeleted callback receives a BaseMessage object with the deletedAt and deletedBy fields set. Access the data using getter methods:
| Field | Getter | Return Type | Description |
|---|---|---|---|
| id | getId() | number | Unique message ID |
| sender | getSender() | User | The user who sent the message |
| deletedAt | getDeletedAt() | number | Timestamp when the message was deleted |
| deletedBy | getDeletedBy() | string | UID of the user who deleted the message |
Missed Message Delete Events
When fetching message history, deleted messages havedeletedAt and deletedBy fields set. Additionally, an Action message is created when a message is deleted.
The Action object contains:
action—deletedactionOn— Deleted message objectactionBy— User who deleted the messageactionFor— Receiver (User/Group)
You must be the message sender or a group admin/moderator to delete a message.
Next Steps
Edit a Message
Edit sent messages in conversations
Send Messages
Send text, media, and custom messages
Receive Messages
Listen for incoming messages in real-time
Flag a Message
Report inappropriate messages