Updating messages

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.

pubnub.addMessageAction(
{
channel: 'main'
messageTimetoken: '15610547826970040',
action: {
type: 'updated',
value: 'Hello World! (fixed typo)',
},
},
function(status, response) {
}
);

Message update event

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

{
"channel":"main",
"subscription":null,
"timetoken":"15610547826970040",
"publisher":"user-1",
"message":{
"source":"actions",
"version":"1.0",
"action":"added",
"data":{
"type":"updated",
"value":"Hello World! (fixed typo)",
"messageTimetoken":"15610547826970040",
"actionTimetoken":"15610547826999081"
}
show all 17 lines
Last updated on