Control the ThriveDesk Assistant programmatically through its global JavaScript API.
Call Assistant methods after installation, and use the ready callback for anything that depends on
the initialized widget.
| Method | Purpose | Prerequisite |
|---|---|---|
Assistant('init', assistantId) | Load an Assistant with its launcher. | Valid Assistant ID |
Assistant('trigger-less-init', assistantId) | Load without the launcher. | Valid Assistant ID |
Assistant('triggerLess') | Hide or disable the launcher. | Initialized Assistant |
Assistant('open') | Open the Assistant. | Ready Assistant |
Assistant('close') | Close the Assistant. | Ready Assistant |
Assistant('toggle') | Toggle its open state. | Ready Assistant |
Assistant('chat') | Open Chat. | Chat enabled |
Assistant('contact', options) | Open Contact and optionally prefill it. | Contact enabled |
Assistant('order-status') | Open Order Status. | Order Status enabled |
Assistant('identify', user) | Prefill a visitor's name and email. | Ready Assistant |
Assistant('article', article) | Open a Knowledge Base article. | Article ID |
Assistant.clearSession() | Clear local chat/session state. | Initialized Assistant |
Assistant('ready', callback) | Run code after initialization. | Installation snippet |
Assistant('ready', () => {
Assistant('contact', {
subject: 'Invoice INV-1042',
body: 'I need help understanding this charge.'
});
});Assistant('article', 'ARTICLE_ID');
Assistant('article', {
articleId: 'ARTICLE_ID',
mode: 'sidebar'
});Find the article ID by opening the article editor in ThriveDesk.
async function logout() {
Assistant.clearSession();
await endApplicationSession();
}Clearing the Assistant session removes local chat history and conversation context for that browser.