Skip to content

JavaScript SDK

Open in workspace →

The JavaScript SDK lets you control the messenger widget from your frontend code.

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 visitor
promptify.setUser({ id: null });

See User Identification for details on the user data fields and JWT signing.

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.