Django integration

1. Add the snippet to your layout

Use the async loader from the docs home.

2. Server-side user hash

import hmac, hashlib, os

def rokochat_user_hash(user_id: str) -> str:
    return hmac.new(
        os.environ["ROKOCHAT_IDENTITY_SECRET"].encode(),
        str(user_id).encode(),
        hashlib.sha256,
    ).hexdigest()

3. Call identify() in the browser

Rokochat.identify({
  id: user.id,
  user_hash: userHash,
  email: user.email,
  name: user.name,
});

Always call Rokochat.logout() when the user signs out.