Skip to content
CoristenCoristen
Esc
↑↓navigate↵open⌘Jpreview
On this page

Installation

Install the package and connect all widgets with one API key pair.

Use this procedure to add Coristen to a React application.

Get the keys

  1. In Coristen, open Settings > API keys.
  2. Create an API key pair.
  3. Copy the public key. Its prefix is coristen_pk_.
  4. Store the server key in a safe location. Coristen shows this key only once.

Use the same public key for the floating widget, dock, modal, and contact form. Use the server key only for customer identity.

Install the package

npm install @coristen/widget
pnpm add @coristen/widget
yarn add @coristen/widget
bun add @coristen/widget
nub add @coristen/widget
aube add @coristen/widget

Add chat

Import the CSS file once in your application.

"use client"

import { CoristenWidget } from "@coristen/widget"
import "@coristen/widget/styles.css"

export default function Support() {
  return <CoristenWidget apiKey="coristen_pk_..." />
}

Replace coristen_pk_... with your public key. Add Support to your application layout.

Set an environment variable

For Next.js, put the public key in .env.local:

NEXT_PUBLIC_CORISTEN_KEY=coristen_pk_...

Use this variable in the component:

<CoristenWidget apiKey={process.env.NEXT_PUBLIC_CORISTEN_KEY!} />

Use this same variable for the other widgets. Do not put the server key in a variable with the NEXT_PUBLIC_ prefix.

Check the installation

  1. Open your website.
  2. Select the chat button.
  3. Send a message.
  4. In Coristen, open Conversations.
  5. Make sure that the message is in the inbox.

If Coristen blocks the website, check Allowed websites. To add a form, use the contact form procedure.

Was this page helpful?