GoGo V4 Message Actions API Reference for Realtime Apps

Add or remove actions on published messages to build features like receipts, reactions or to associate custom metadata to messages. Clients can subscribe to a channel to receive message action events on that channel. They can also fetch past message actions from PubNub Storage independently or when they fetch original messages.


Requires Storage & Playback add-on XRequires that the Storage & Playback add-on is enabled for your key. See this page on enabling add-on features on your keys:

http://www.pubnub.com/knowledge-base/discussion/644/how-do-i-enable-add-on-features-for-my-keys.

Add an action on a published message. Returns the added action in the response.

To Add a Message Action you can use the following method(s) in the Go V4 SDK:

  1. ParameterTypeRequiredDescription
    ChannelstringYesThe channel name.
    MessageTimetokenstringYesThe publish timetoken of a parent message.
    Actionpubnub.MessageActionYesMessage Action Details :-
    ActionType: What feature this action represents -- max 15 characters.
    ActionValue: Details about the action -- max 40 characters.
ma := pubnub.MessageAction{
    ActionType:  "reaction",
    ActionValue: "smiley_face",
}

res, status, err := pn.AddMessageAction().Channel("my-channel").MessageTimetoken("15698453963258802").Action(ma).Execute()

The AddMessageAction() operation returns a PNAddMessageActionsResponse which contains the following parameters:

Property NameTypeDescription
DataPNMessageActionsResponseDetails of type PNMessageActionsResponse are here.
Property NameTypeDescription
ActionTypestringWhat feature this action represents.
ActionValuestringDetails about the action.
ActionTimetokenstringThe timetoken when the action was added.
MessageTimetokenstringThe timetoken of the parent message.

Requires Storage & Playback add-on XRequires that the Storage & Playback add-on is enabled for your key. See this page on enabling add-on features on your keys:

http://www.pubnub.com/knowledge-base/discussion/644/how-do-i-enable-add-on-features-for-my-keys.

Remove a peviously added action on a published message. Returns an empty response.

To Remove a Message Action you can use the following method(s) in the Go V4 SDK:

  1. ParameterTypeRequiredDescription
    ChannelstringYesThe channel name.
    MessageTimetokenstringYesThe publish timetoken of a parent message.
    ActionTimetokenstringYesThe publish timetoken of the action.
res, status, err := pn.RemoveMessageAction().Channel("my-channel").MessageTimetoken("15698453963258802").ActionTimetoken("15698453963258812").Execute()

The RemoveMessageAction() operation returns a PNRemoveMessageActionsResponse which contains the following parameters:

Property NameTypeDescription
Datainterface{}Returns an empty interface.

Requires Storage & Playback add-on XRequires that the Storage & Playback add-on is enabled for your key. See this page on enabling add-on features on your keys:

http://www.pubnub.com/knowledge-base/discussion/644/how-do-i-enable-add-on-features-for-my-keys.

Get a list of message actions in a channel. Returns a list of actions in the response.

To Get Message Actions you can use the following method(s) in the Go V4 SDK:

  1. ParameterTypeRequiredDescription
    ChannelstringYesThe channel name.
    StartstringOptionalAction timetoken denoting the start of the range requested (return values will be less than start).
    EndstringOptionalAction timetoken denoting the end of the range requested (return values will be greater than or equal to end).
    LimitintOptionalNumber of actions to return in response..
res, status, err := pn.GetMessageActions().Channel("my-channel").Start("15698453963258812").End("15698453963258802").Execute()

The GetMessageActions() operation returns a PNGetMessageActionsResponse which contains the following parameters:

Property NameTypeDescription
Data[]PNMessageActionsResponseDetails of type PNMessageActionsResponse are here.
MorePNGetMessageActionsMoreDetails of type PNGetMessageActionsMore are here.
Property NameTypeDescription
URLstringThe URL for the next set of results.
StartstringThe start param for the next set of results.
EndstringThe end param for the next set of results.
LimitintThe limit for the next set of results.