Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add switchWidget API #6

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion docs/api-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ Use the JavaScript API to manipulate the chat widget displayed on your website.
- [addTags](#addtags)
- [removeTags](#removetags)
- [secureMode](#securemode)
- [switchWidget](#switchwidget)
- [customStyle](#customstyle)

<br/>
Expand Down Expand Up @@ -749,7 +750,19 @@ this.$tawkMessenger.visitor({
name : 'Name',
email : '[email protected]',
hash : '<calculate-hash>'
})
});
```

<br/>

## switchWidget
Disconnect the current widget connection and switch to another widget.

```js
this.$tawkMessenger.switchWidget({
propertyId : 'property_id',
widgetId : 'widget_id'
});
```

<br/>
Expand Down
1 change: 1 addition & 0 deletions src/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ class TawkMessenger {
this.root.addEvent = (event, metadata, callback) => window.Tawk_API.addEvent(event, metadata, callback);
this.root.addTags = (tags, callback) => window.Tawk_API.addTags(tags, callback);
this.root.removeTags = (tags, callback) => window.Tawk_API.removeTags(tags, callback);
this.root.switchWidget = (options) => window.Tawk_API.switchWidget(options);
}
}

Expand Down