Skip to content

Commit e34e754

Browse files
merged main
2 parents 93c311e + 1b803fd commit e34e754

File tree

1 file changed

+28
-29
lines changed

1 file changed

+28
-29
lines changed

fern/docs/pages/sdks/web/user-identity.mdx

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Ensure you copy your access token, as you will not be able to view it again.
1616
## Generate a session token
1717

1818
<Callout intent="note">
19-
For security reasons, this API call must be made from your server side to prevent exposing your Application Access Token (AAT).
19+
For security reasons, this API call must be made from the server side to prevent exposing your application access token (AAT).
2020
</Callout>
2121

2222
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](https://devrev.ai/docs/product/grow).
@@ -54,16 +54,16 @@ curl --location 'https://api.devrev.ai/auth-tokens.create' \
5454
}
5555
}
5656
}'
57-
```
57+
```
5858

5959
**Attributes for [users](https://developer.devrev.ai/public/api-reference/dev-users/product-builders-and-service-providers)**
6060

6161
| Attributes | Description | Type | Required | Unique |
6262
|---------------|-----------------------------------------------------------------------------|--------|----------|--------|
63-
| user_ref | A unique user reference that the DevRev app uses for identifying your users. This parameter is required. | string |||
64-
| email | The email address of the customer. It's used for sending email notifications of any support messages. | string ||** |
65-
| display_name | The name of the user that's shown on the widget. | string |* ||
66-
| phone_numbers | The customer's mobile number, which must adhere to the E.164 format. | array |||
63+
| `user_ref` | A unique user reference that the DevRev app uses for identifying your users. This parameter is required. | string |||
64+
| `email` | The email address of the customer. It's used for sending email notifications of any support messages. | string ||** |
65+
| `display_name` | The name of the user that's shown on the widget. | string |* ||
66+
| `phone_numbers` | The customer's mobile number, which must adhere to the E.164 format. | array |||
6767

6868
* If nothing is specified, a system-generated name is assigned to the user.
6969

@@ -78,12 +78,12 @@ curl --location 'https://api.devrev.ai/auth-tokens.create' \
7878

7979
**Attributes for [accounts](https://developer.devrev.ai/public/api-reference/accounts/accounts)**
8080

81-
| Attributes | Description | Type | Required | Unique |
82-
|-----------------|-------------------------------------------------------------------------------------------------------------------|--------|----------|--------|
83-
| `account_ref` | A unique reference for the account. | string || |
84-
| `display_name` | The name of the account that's shown on the widget. | string |||
85-
| `domains` | Use a unique format like 'devrev.ai'. Formats such as 'https://devrev.ai' or 'www.devrev.ai' are not valid. | array |||
86-
| `phone_numbers` | The phone number associated with the account in E.164 format. | array || |
81+
| Attributes | Description | Type | Required | Unique |
82+
|-----------------|-------------------------------------------------------------------------------------------------------------------------|--------|----------|--------|
83+
| `account_ref` | A unique reference for the account. | string |||
84+
| `display_name` | The name of the account that's shown on the widget. | string |||
85+
| `domains` | The attribute must be unique. Use a format like `devrev.ai`. Inputs like `https://devrev.ai` or `www.devrev.ai` are invalid. | array |||
86+
| `phone_numbers` | The phone number associated with the account must be in E.164 format. | array |||
8787

8888
<Callout intent="note">
8989
Ensure that you follow the specified format when populating phone numbers and domains in the request body.
@@ -118,6 +118,8 @@ You can pass custom traits, as shown above, not only for `users` but also for `w
118118

119119
### How resolution works
120120

121+
When you send object information to DevRev, the system automatically creates or finds existing contacts, accounts, and workspaces.
122+
121123
DevRev offers three ways to structure your customer's data:
122124

123125
| Hierarchy Type | Documents Created | What to Include | Use Case |
@@ -126,7 +128,7 @@ DevRev offers three ways to structure your customer's data:
126128
| **Two-level** | Accounts and Contacts linked to the account | User and account information | Recommended for most B2B cases |
127129
| **Three-level** | Account with linked workspaces and contacts | User, workspace and account information | Used for B2B cases but only recommended if your business model requires workspace organization |
128130

129-
In a DevOrg, unique identifiers are utilized to handle objects. If an object doesn't exist, it is created and then an attempt is made to link it. For example, here's how it operates:
131+
**What happens when you send different combinations:**
130132

131133
User reference:
132134
- A user reference is mandatory, ensuring its constant presence.
@@ -147,12 +149,10 @@ This approach ensures efficient management and integration of objects within the
147149

148150
### Best practices
149151

150-
- Populate user traits like email and display name to:
151-
- Make users identifiable
152-
- Prevent duplicate users across integrations
153-
- Maintain consistent unique identifiers across your system
154-
- Follow the specified formats for phone numbers and domains
155-
- Keep your application access token secure
152+
- Populate user traits like email and display name to make users identifiable and to prevent duplicate users across integrations.
153+
- Maintain consistent unique identifiers across your system.
154+
- Follow the specified formats for phone numbers and domains.
155+
- Keep your application access token secure.
156156

157157
## Pass the session token
158158

@@ -165,7 +165,7 @@ const sessionToken = '<SESSION_TOKEN>'
165165
<script>
166166
(() => {
167167
window.plugSDK.init({
168-
app_id: '<your_unique_app_id>',
168+
app_id: '<your_unique_app_id>',
169169
session_token: sessionToken
170170
})})();
171171
</script>
@@ -187,17 +187,17 @@ This method is currently in beta and comes with the following limitations:
187187

188188
```jsx
189189
window.plugSDK.init({
190-
app_id: '<your_unique_app_id>',
190+
app_id: appId,
191191
identity: {
192-
user_ref: string;
193-
user_traits?: { // optional
194-
custom_fields?: object; // optional
195-
display_name?: string; // optional
196-
email?: string; // optional
197-
phone_numbers?: string[]; // optional
192+
user_ref: userRef,
193+
user_traits: { // Optional user details
194+
custom_fields?: object,
195+
display_name: 'John Doe',
196+
197+
phone_numbers: ['+1234567890']
198198
}
199199
}
200-
})
200+
});
201201
```
202202

203203
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.
@@ -212,4 +212,3 @@ window.plugSDK.updateIdentity({
212212
}
213213
})
214214
```
215-

0 commit comments

Comments
 (0)