Widget and help center
Add the chat widget to your site
Put a Chat with us button on your site with the public key of your brand.
The chat widget puts a Chat with us button on your pages. A customer writes a question, and the conversation goes to your inbox. The widget does not change your page, and your page does not change the widget. This article shows the steps for a developer.
Before you start
Each brand has a public widget key. The key starts with ohs_pk_. It is safe to show in the browser. Do not use a secret key in the browser. You need the secret key of the tenant, or the admin role, for the first step.
Allow your origin
OHSupport accepts widget requests only from the origins that you allow for the brand. An example of an origin is https://www.yourcompany.com. Add the origin to the allowed origins of the brand. The API field is allowedOrigins. The list replaces the old list, so include all origins each time.
Add the script
- Add the OHSupport widget script to each page that must show the button.
- Set the data-ohs-key attribute to the public key of your brand.
- Optional: set data-ohs-title to the text for the top of the panel.
- Optional: set data-ohs-accent to the color of your brand.
- Open your page. Make sure that the Chat with us button shows.
What the customer sees
The customer writes an email address and a question. The conversation goes to your inbox. Your replies show in the widget and in email.
The widget shows in a Shadow DOM. The CSS of your page does not change it.
Control the widget from your code
The script makes the object window.OHSupport. It has these functions: identify, open, close and reset. Use open to show the panel. Use open with a subject and a topic to start a new request with values in the form. Use reset when the customer signs out of your application.
Your code can run before the script loads. In that case, put the calls in the queue window.OHSupport.q. The widget does the queued calls when it starts.
To keep a customer signed in, read the article about handoff tokens. Developers can read the full steps in the integration guide, docs/integrations.md.
If the widget shows This origin is not allowed, add your origin to the allowed origins of the brand.