$sitegpt Methods
An in-depth guide on how to use $sitegpt to control the SiteGPT chatbot from your javascript code.
Add custom css to your chatbot widget
- Description: Apply your own css to the chatbot widget and style it as per your branding.
- Syntax:
window.$sitegpt.push(["set", "css", "css_string"])
Give extra context to your chatbot
- Description: Give more information to your SiteGPT bot for contextual conversations.
- Syntax:
window.$sitegpt.push(["set", "context", ["prompt_prefix_string", "prompt_suffix_string"]])
Automatically log the user in
- Description: Automatically log the user in, in the chatbot widget. The users need not enter/verify their email manually.
- Syntax:
window.$sitegpt.push(["set", "user:email", ["email_string", "email_signature_string"]])
To generate the signature, you can use the following code:
Make sure you generate signatures with the HMAC-SHA256 algorithm.
Any other HMAC digest is not accepted and will be refused by SiteGPT chatbot when provided.
What makes User Verification secure?
User Verification makes use of the HMAC-SHA256
signature algorithm. It is recognized as secure and is widely used to authenticate data across the internet.
When setting a user email via the SiteGPT’s JavaScript SDK, you should also set the signature parameter with the signature computed on your backend.
This signature is computed using your API key, that only you and SiteGPT know. So, only SiteGPT and you are able to generate valid signatures for a given email. An attacker without your API key will not be able to generate valid signatures, and thus will not be able to impersonate users chatting with you.
Never generate signatures directly in your front-end.
If you do that, your API key will be exposed and anyone who has the API key can
impersonate other users.
Always generate all your signatures on your backend, and never leak
your API key.
Was this page helpful?