Identify your users with PLuG
Once you have installed PLuG, all your users who interact with the widget are created as anonymous users in the DevRev app with a random name since there is no information about the user.
For users who are logged into your website, you can identify them in PLuG to enable them to view their conversation history and receive more personalized engagement.
To implement user identification, you need to generate a session token for each user who visits your website. This token is created using your application access token combined with customer information, and must be generated on your backend to keep the application token secure.
Generate an application access token
- In DevRev, go to Settings > Support > PLuG Tokens through the settings icon on the top-left corner.
- Under the Application access tokens panel, click New token and copy the token that’s displayed.
Ensure you copy your access token, as you cannot view it again.
Generate a session token
For security reasons, this API call must be made from the server side to prevent exposing your application access token (AAT).
Using the rev_info
method, you can generate and recognize a user within the DevRev system by providing relevant user details. This method enables you to convey information systematically, ensuring alignment between your DevRev CRM and the structured data model. For information regarding terminologies, click here.
Attributes for users
- If nothing is specified, a system-generated name is assigned to the user.
** Email uniqueness is subjected to organization preferences. If organization want, it can be marked non unique. But it is not recommended.
Attributes for workspaces
Attributes for accounts
Ensure that you follow the specified format when populating phone numbers and domains in the request body.
Pass custom attributes
To create custom attributes, see Object customization.
You can pass the custom attributes that are created as shown below:
You can pass custom traits, as shown above, not only for users
but also for workspaces
and accounts
.
API status codes and troubleshooting
How resolution works
When you send object information to DevRev, the system automatically creates or finds existing contacts, accounts, and workspaces.
DevRev offers three ways to structure your customer’s data:
What happens when you send different combinations:
User reference:
- A user reference is mandatory, ensuring its constant presence.
- If a user with the provided reference doesn’t exist, the system automatically creates the user.
This approach ensures efficient management and integration of objects within the DevOrg.
Best practices
- Populate user traits like email and display name to make users identifiable and to prevent duplicate users across integrations.
- Maintain consistent unique identifiers across your system.
- Follow the specified formats for phone numbers and domains.
- Keep your application access token secure.
Pass the session token
While initializing the PLuG widget you pass the session token for DevRev to identify this user and thereby make the widget more customized for the user and their context.
Identify users without session token
You can also pass the identifiers in the plugSDK.init
option without generating the session token.
This frontend user identification, by its nature, is not secure as the data is transmitted through the client side. It is recommended to use the session token method to securely identify users.
This method is currently in beta and comes with the following limitations:
- Unverified users cannot be converted or merged into verified users.
- An external reference used by an unverified user cannot be reused for any other user.
You can add or update the data in user_traits
by using the updateIdentity
method on the PLuG SDK. Attached is a sample code snippet for the same.