Install the live chat widget on Flask
XACUBE puts a live chat widget on your Flask site, so your live agents can answer visitors the moment they ask, from one shared inbox. The free plan covers one agent.
- Open
templates/base.htmland paste the code just before</body>. - Publish your site. The chat appears on every page.
<script src="https://chat.xacube.chat/w.js" data-key="YOUR_PUBLIC_KEY" async></script>
Replace YOUR_PUBLIC_KEY with your own key. In your panel, open your website and this code is shown with your key already in it.
Recognise signed-in customers
import hashlib, hmac, os
xacube_hash = hmac.new(os.environ['XACUBE_SECRET_KEY'].encode(), str(current_user.id).encode(), hashlib.sha256).hexdigest()
<!-- templates/base.html -->
<script src="https://chat.xacube.chat/w.js" data-key="YOUR_PUBLIC_KEY"
data-user-id="{{ current_user.id }}"
data-user-hash="{{ xacube_hash }}"
data-user-name="{{ current_user.name }}"
data-user-email="{{ current_user.email }}" async></script>