On Shopify: automatic
On a Shopify store with the Aide chat app embed on, a shopper who is logged in to their store account is recognised automatically. Their name and email come from the store, and Aide can look up and act on their orders straight away. When they log out, the chat is signed out too. You don’t need to write any code. An email the shopper types in the chat can’t unlock someone else’s orders: the store account decides whose orders Aide sees. Automatic recognition needs the app’s default storefront path,/apps/aide.
On other sites: call identify
Signed and unsigned identify
Anyone can run JavaScript on your page, so Aide only trusts an identity that your server has signed.- Signed (with
hash): the visitor is verified. Conversations from the sameuserIdon other devices are merged and the customer sees their history. - Unsigned (no
hash, or a wrong one): Aide uses the name and email as display information only. The visitor stays unverified, nothing is merged, and they only see conversations from this browser.
identify with a valid hash.
Compute the hash
The hash is an HMAC-SHA256 of theuserId, using your workspace secret as the key, written as hexadecimal. Compute it on your server, never in the browser:
POST /v1/widgets/{id}/secret, with an API key; see API keys and webhooks), which returns the new secret once. Rotating it invalidates old hashes, so deploy the new secret to your server at the same time.
When the customer signs out
CallAide('logout') so the next person on the same computer doesn’t see their conversations. By default a chat in progress is allowed to finish; pass { endActiveChat: true } to end it.