JavaScript SDK
The JavaScript SDK lets you control the messenger widget from your frontend code.
Methods
Section titled “Methods”setUser
Section titled “setUser”Identify the current user or set them as anonymous:
// Identified user (without verification)promptify.setUser({ id: "user-123", email: "jane@example.com", name: "Jane Doe", avatarUrl: "https://example.com/avatar.jpg", attrs: { plan: "pro", signedUp: 1700000000, }, organizations: [{ id: "org-456", name: "Acme Corp" }],});
// Identified user (with signed JWT)promptify.setUser({ jwt: "eyJ..." });
// Anonymous visitorpromptify.setUser({ id: null });See User Identification for details on the user data fields and JWT signing.
setTheme
Section titled “setTheme”Switch to a named theme configured in the dashboard:
promptify.setTheme("dark");Themes are created and configured in Settings > Messenger > Themes. The setTheme method switches between them by name at runtime.