Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ All the available Crisp API resources are fully implemented. **Programmatic meth

All methods that you will most likely need when building a Crisp integration are prefixed with a star symbol (⭐).

**⚠️ Note that, depending on your authentication token tier, which is either `user` or `plugin`, you may not be allowed to use all methods from the library. When in doubt, refer to the library method descriptions below. Most likely, you are using a `plugin` token.**
**⚠️ Note that, depending on your authentication token tier, which is either `user`, `website` or `plugin`, you may not be allowed to use all methods from the library. When in doubt, refer to the library method descriptions below. Most likely, you are using a `plugin` token.**

---

Expand Down
10 changes: 8 additions & 2 deletions lib/crisp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import Website, { WebsiteServiceInterface } from "@/services/website";

export type RTM_MODES = "websockets" | "webhooks";

export type CrispTier = "user" | "plugin";
export type CrispTier = "user" | "website" | "plugin";

/**************************************************************************
* CONSTANTS
Expand Down Expand Up @@ -323,7 +323,7 @@ class Crisp {
/**
* Sets the authentication tier
*/
setTier(tier: "user" | "plugin") {
setTier(tier: "user" | "website" | "plugin") {
this.auth.tier = (tier || "user");
}

Expand Down Expand Up @@ -754,6 +754,12 @@ class Crisp {
let restUrlSegments;

switch (this.auth.tier) {
case "website": {
restUrlSegments = ["website", "connect", "endpoints"];

break;
}

case "plugin": {
restUrlSegments = ["plugin", "connect", "endpoints"];

Expand Down
Loading