Guest Session only allows to capture Custom Attributes on the inbound direction: these are then propagated into the platform as Participant Data. The opposite transformation is not supported.
Are you trying to set CustomAttributes for the inbound direction?
You can check these examples
The message is inbound, I'm sending it as a user from the web page. I saw this example.
And, in fact, my implementation includes setting attributes (I call this before I call sendMessage command):
But I don't see CustomAttributes as part of the message instance when the onMessageReceived event is called. I had maybe 2 or 3 times when I got CustomAttributes on that event, but the behaviour seems random as there were no changes to the code.
Besides, even if the message had CustomAttributes in the onMessageReceived event when I'm retrieving history I don't have the channel field there, and thus no CustomAttributes.
Am I doing something wrong, or is this the expected behaviour and CustomAttributes are sent once with the message for the purpose of defining custom behaviour on the server (Genesys cloud)?
UPD:
I just encountered the same “weird” behavior, where I got CustomAttributes for one message but not for the next one, even though the code is the same.
Hi @DmytroK, Database.set command is meant to be used once during initialization. For any subsequent updates, you can use Database.updatecommand. This custom data will then be included to be sent along with the inbound messages when using MessagingService.sendMessage command, but the behavior can be asynchronous, meaning when ever it gets updated in the database plugin, it will then be included in the inbound message request sent from Messenger.
@DmytroK when you set/update the customAttributes, it will be sent in every message. But don't expect it to be sent as soon as you set it, instead it will be sent asynchronously and come back accordingly.