On this page

Updating messages (deprecated)

Use Chat SDKs

This documentation is deprecated. Use any of our dedicated Chat SDKs to quickly implement chat functionality in your application.

Since PubNub stores all messages in a time-series database, it doesn’t expose an API to directly update a message. However, clients can update messages by passing another version of the message using the Message Reactions feature.

User ID / UUID

User ID is also referred to as UUID/uuid in some APIs and server responses but holds the value of the userId parameter you set during initialization.

Update a message

Use the addMessageAction method to update a published message after it has been published by adding an action to it.

1pubnub.addMessageAction(
2 {
3 channel: 'main'
4 messageTimetoken: '15610547826970040',
5 action: {
6 type: 'updated',
7 value: 'Hello World! (fixed typo)',
8 },
9 },
10 function(status, response) {
11 }
12);

Message update event

PubNub triggers events when messages are updated using message reactions. Clients subscribed to the channel will receive these events.

1{
2 "channel":"main",
3 "subscription":null,
4 "timetoken":"15610547826970040",
5 "publisher":"user-1",
6 "message":{
7 "source":"actions",
8 "version":"1.0",
9 "action":"added",
10 "data":{
11 "type":"updated",
12 "value":"Hello World! (fixed typo)",
13 "messageTimetoken":"15610547826970040",
14 "actionTimetoken":"15610547826999081"
15 }
show all 17 lines
Last updated on