For an added layer of security, verify the identity of the user sending a message through the chat widget to prevent your customers from manually changing their email in the frontend to impersonate each other.

Pylon is not unique on this front.

Adding identity verification is optional, but encouraged.


Generate an Identity Secret

Generate it here and save it, this will be the only time you will see this key.

If you lose your key you’ll need to regenerate it and replace the key later.


Setup Backend

In your backend, hash the user’s email address using HMAC-SHA256 with the secret you just generated.

Here are some code snippets to help:

const { createHmac } = require("node:crypto");

const email = "CHAT_USER_EMAIL";

const verificationHash = createHmac("sha256", secret)

Send this hash to the Frontend and set it on the window object:

window.pylon.chat_settings.email_hash = HMAC_HASH

Now the user is verified when they open the chat!