React-Crisp

React implementation for the messaging application Crisp

Install

npm add react-crisp
or
yarn add react-crisp

Usage

/* Import the component */
import Crisp from 'react-crisp';

/* Insert the componenent */
<Crisp crispWebsiteId="the-website-id-given-by-crisp" />

Identify the user and assign attributes

<Crisp
    crispWebsiteId="the-website-id-given-by-crisp" // Required
    crispTokenId="a-unique-token-for-the-user"
    attributes={{
        "user:email": ["[email protected]"],
        "user:nickname": ["foo42"],
    }}
/>

For a complete list of attributes please see the Crisp's Docs.

Configuration

<Crisp
    crispWebsiteId="the-website-id-given-by-crisp" // Required
    crispTokenId="a-unique-token-for-the-user"
    configuration={{
        "position:reverse": [true],
    }}
/>

For a complete list of parameters please see the Crisp's Docs.

Safe mode

To prevent Crisp to emit errors when an exception occurs, you may enable the Safe Mode (see Crisp's Docs. With react-crisp it's done like this:

<Crisp
    crispWebsiteId="the-website-id-given-by-crisp" // Required
    safeMode
/>

Set CRISP_RUNTIME_CONFIG

<Crisp
    crispWebsiteId="the-website-id-given-by-crisp" // Required
    crispRuntimeConfig={{
      session_merge: true,
    }}
/>

For more details about the variable CRISP_RUNTIME_CONFIG see Crisp's Docs.

GitHub

https://github.com/Mergifyio/react-crisp