You need to use Headless SDK or Guest Messaging API and include this:
Genesys("command", "Database.set", { messaging: { customAttributes: { myKey: 'value' }}});
Then try to retrieve the myKey attribute with Get Participant Data action and store in local State.MyKey variable.