Provide a user
There are two modes the <Messenger />
component can function under: guest and signed-in.
Guest mode
This is the default mode if you don't pass any configuration in the authOptions
property. In this mode, the user can still contact you but they will have a random alias in the form of an adjective and a noun, like "Purple Cat from USA" or "Pink Elephant from Greece". The location is determined by the browser's timezone, so it's not always accurate.
The alias is stored locally for 7 days (or otherwise configured via the authOptions.anonymousSignedInDuration
property) and a guest customer is also created in the database. This way, if the user comes back to the website, they will have the same alias and conversation history.
Most probably, however, for the quantity and quality of your feedback you'll want to gatekeep the conversations behind a sign up. This is where the signed-in mode comes in.
Signed-in mode
If you pass a user object in the authOptions
property, the user will be signed in. This means that the user will have the same alias and conversation history across devices and sessions. The user object should have the following properties:
1
2
3
4
5
6
7
8
9
10
11
<Messenger
publicKey='your-public-key'
authOptions={{
user: {
id: 'your-user-id',
name: 'Jane Doe',
email: '[email protected]',
photoUrl: 'https://example.com/photo.jpg'
}
}}
/>
These credentials are in no way verified by the Makkuro backend, so it's your responsibility to make sure the user is who they say they are.
The id
property corresponds to the unique ID that your authentication system provides so that the same customer can be identified across devices and sessions also if they change their personal information.
Which mode to use?
Obviously, it depends on your needs and workload but here are a few use cases that might guide you:
- Provide a full chat experience for signed-in users in your web app.
- Provide some basic links with help or pricing and no chat functionality for guest users in your marketing website.
- Provide a guest chat experience for guest users in your Docs website.