Do Custom Attributes Set by Database Plugin Persist?

In our application, we use the Database plugin from the Messenger JavaSript SDK to set a custom attribute on conversation start. Through out the conversation we could retrieve the same attribute using Database.get command successfully.
However, if the page is refreshed and we try to get the attribute again after the MessengingService.restored event is published, we get an empty object from the response of Database.get command.
We would like to ask if this is the expected behavior?

Code snippet is shown below:

function startConversation() {
   Genesys("command", "Database.update", { messaging: { customAttributes: { Custom_Attribute_A: "abc" } } });
   Genesys("command", "MessagingService.startConversation",
        {},
        () => {
            Genesys("command", "Database.get", {}, (data) => {
              // This logs {"messaging":{"customAttributes":{"Custom_Attribute_A":"abc"}}}
              console.log(data);
            });
        },
        () => {}
      );
}

// Called after MessagingService is ready on page load
function subscribeToRestore() {
   Genesys("subscribe", "MessagingService.restored", () => {
       Genesys("command", "Database.get", {}, (data) => {
          // This logs an empty object {}
          console.log(data);
        });
   }
}

Yes, that behavior is by-design: we explicitly want to avoid storing any (potentially sensitive) data on the browser's storage. Note that once Participant Data is added to the conversation, it will remain available on the conversation itself throughout its duration: you can retrieve it within GC platform (for example using Get Participant Data action) , but does not persist on the End-User's browser.

1 Like

@Angelo_Cicchitto Thank you for the response. We are asking this because in our application, customer is asked to enter their nickname before starting the conversation, this nickname will be shown in our messenger UI and we would like the name to remain upon page refresh. We are aware that we could make use of the Analytics API to retrieve the participant data but we would like to know if this can be achieved using the SDK only. Your advice would be appreciated.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.