{"Status":true,"Message":"","Response":{"post":{"postuid":"26ba158c-e91c-4e45-b768-c0447d61c4f8","tenantuid":"d8b744fc-2e70-4089-bb80-dd1d08f6c7b2","projectuid":"fc6490ac-7527-4f49-b06e-46f701280e85","title":"Chat Accounts","slug":"article/chat-accounts","html":"\u003Cp\u003EAccounts are the companies your customers belong to, such as a workspace, team or tenant in your product. When conversations and tickets are filed under an account, your team can see everything from one company in one place, and your own app can show a company its tickets.\u003C/p\u003E\u003Cp\u003EAccounts are added in three ways: your website sends a signed company when a signed-in customer opens the messenger, a teammate adds or imports them on the \u003Cb\u003EAccounts\u003C/b\u003E page, or your app syncs them through the API.\u003C/p\u003E\u003Ch2 id=\u0022send_the_company_from_your_website\u0022\u003ESend the company from your website\u003C/h2\u003E\u003Cp\u003EPass \u003Ccode\u003Ecompany\u003C/code\u003E and \u003Ccode\u003Ecompany_hash\u003C/code\u003E in the messenger settings, alongside the signed-in customer\u0027s details. The company is accepted only for a customer verified with \u003Ccode\u003Euser_hash\u003C/code\u003E, so set up \u003Ca href=\u0022/article/chat-identity-verification\u0022\u003Eidentity verification\u003C/a\u003E first. Without a valid hash the company is ignored, and the messenger still loads normally.\u003C/p\u003E\u003Cdiv class=\u0022code_wrapper\u0022\u003E\u003Cdiv class=\u0022code\u0022 data-language=\u0022javascript\u0022\u003Ewindow.DocentSettings = {\n  app_id: \u0026quot;YOUR_APP_ID\u0026quot;,\n  user_id: \u0026quot;12345\u0026quot;,\n  email: \u0026quot;jane@example.com\u0026quot;,\n  name: \u0026quot;Jane Doe\u0026quot;,\n  user_hash: \u0026quot;USER_HASH_FROM_YOUR_SERVER\u0026quot;,\n  company: {\n    id: \u0026quot;acme-42\u0026quot;,       // your id for the company (required)\n    name: \u0026quot;Acme Corp\u0026quot;,   // optional\n    plan: \u0026quot;Growth\u0026quot;       // any other fields are kept as details\n  },\n  company_hash: \u0026quot;COMPANY_HASH_FROM_YOUR_SERVER\u0026quot;\n};\u003C/div\u003E\u003C/div\u003E\u003Cul\u003E\u003Cli\u003E\u003Ccode\u003Eid\u003C/code\u003E is required: your own id for the company, up to 256 characters, without a \u003Ccode\u003E|\u003C/code\u003E character.\u003C/li\u003E\u003Cli\u003E\u003Ccode\u003Ename\u003C/code\u003E is optional. It\u0027s what your team sees; without one, the id is shown.\u003C/li\u003E\u003Cli\u003EAny other fields (up to 20) are kept as the account\u0027s details, for example its plan.\u003C/li\u003E\u003C/ul\u003E\u003Cp\u003EIf your site switches the signed-in customer to another company, call \u003Ccode\u003EDocent(\u0027update\u0027, { company: {...}, company_hash: \u0022...\u0022 })\u003C/code\u003E and the messenger picks up the new account. See the \u003Ca href=\u0022/article/chat-messenger-javascript-api\u0022\u003EChat Messenger JavaScript API\u003C/a\u003E.\u003C/p\u003E\u003Ch3 id=\u0022compute_the_company_hash_on_your_server\u0022\u003ECompute the company_hash on your server\u003C/h3\u003E\u003Cp\u003EThe \u003Ccode\u003Ecompany_hash\u003C/code\u003E is made the same way as \u003Ccode\u003Euser_hash\u003C/code\u003E: an HMAC-SHA256 with your messenger\u0027s \u003Cb\u003EIdentity secret\u003C/b\u003E, written as lowercase hex. What you sign is the user\u0027s id, a \u003Ccode\u003E|\u003C/code\u003E character, and the company id. For user \u003Ccode\u003E12345\u003C/code\u003E in company \u003Ccode\u003Eacme-42\u003C/code\u003E, sign \u003Ccode\u003E12345|acme-42\u003C/code\u003E. (If you verify customers by email instead of a user id, sign the email in place of the user id.)\u003C/p\u003E\u003Ctable border=\u00221\u0022 style=\u0022border-collapse: collapse; width: 100%;\u0022\u003E\u003Cthead\u003E\u003Ctr\u003E\u003Cth\u003ELanguage\u003C/th\u003E\u003Cth\u003ECode\u003C/th\u003E\u003C/tr\u003E\u003C/thead\u003E\u003Ctr\u003E\u003Ctd\u003ENode.js\u003C/td\u003E\u003Ctd\u003E\u003Ccode\u003Ecrypto.createHmac(\u0027sha256\u0027, SECRET).update(user.id \u002B \u0027|\u0027 \u002B company.id).digest(\u0027hex\u0027)\u003C/code\u003E\u003C/td\u003E\u003C/tr\u003E\u003Ctr\u003E\u003Ctd\u003EC#\u003C/td\u003E\u003Ctd\u003E\u003Ccode\u003EConvert.ToHexString(new HMACSHA256(Encoding.UTF8.GetBytes(SECRET)).ComputeHash(Encoding.UTF8.GetBytes(user.Id \u002B \u0022|\u0022 \u002B company.Id))).ToLowerInvariant()\u003C/code\u003E\u003C/td\u003E\u003C/tr\u003E\u003Ctr\u003E\u003Ctd\u003EPHP\u003C/td\u003E\u003Ctd\u003E\u003Ccode\u003Ehash_hmac(\u0027sha256\u0027, $user-\u0026gt;id . \u0027|\u0027 . $company-\u0026gt;id, $SECRET)\u003C/code\u003E\u003C/td\u003E\u003C/tr\u003E\u003Ctr\u003E\u003Ctd\u003EPython\u003C/td\u003E\u003Ctd\u003E\u003Ccode\u003Ehmac.new(SECRET.encode(), (user.id \u002B \u0027|\u0027 \u002B company.id).encode(), hashlib.sha256).hexdigest()\u003C/code\u003E\u003C/td\u003E\u003C/tr\u003E\u003C/table\u003E\u003Ccite class=\u0022warning\u0022\u003E\u003Cspan class=\u0022title\u0022\u003EKeep the secret on your server\u003C/span\u003E\u003Cp\u003ENever put the identity secret in browser code. Because the hash covers both the user and the company, a hash copied from one customer\u0027s page can\u0027t put someone else into that company.\u003C/p\u003E\u003C/cite\u003E\u003Ch2 id=\u0022the_accounts_page\u0022\u003EThe Accounts page\u003C/h2\u003E\u003Cp\u003EOpen your messenger and choose \u003Cb\u003EAccounts\u003C/b\u003E in its sidebar. Everyone who works the inbox can look at it; adding, renaming, deleting and importing need an Owner or Admin.\u003C/p\u003E\u003Cp\u003EThe list is in name order and shows each account\u0027s \u003Cb\u003EOpen\u003C/b\u003E and total \u003Cb\u003EConversations\u003C/b\u003E, its \u003Cb\u003EPeople\u003C/b\u003E and when it was \u003Cb\u003ELast seen\u003C/b\u003E, with its id and details underneath. Use \u003Cb\u003ESearch by name or ID\u2026\u003C/b\u003E to find one. Accounts added here, imported or synced are marked \u003Cb\u003EManaged\u003C/b\u003E and are kept even before anyone from them writes in. Click an account\u0027s name to open the inbox showing only that account.\u003C/p\u003E\u003Cul\u003E\u003Cli\u003E\u003Cb\u003EAdd account\u003C/b\u003E: enter your \u003Cb\u003EID\u003C/b\u003E for it and a \u003Cb\u003EName\u003C/b\u003E, then click \u003Cb\u003EAdd\u003C/b\u003E. Adding an id that\u0027s already there updates it.\u003C/li\u003E\u003Cli\u003E\u003Cb\u003ERename\u003C/b\u003E: changes the name. If your website or sync sends a name for that account, theirs replaces it.\u003C/li\u003E\u003Cli\u003EDelete (the bin): removes the account. Its people and conversations are kept, just no longer filed under it. If your website still sends that company, the account comes back the next time someone from it visits.\u003C/li\u003E\u003C/ul\u003E\u003Ch3 id=\u0022import_a_csv_file\u0022\u003EImport a CSV file\u003C/h3\u003E\u003Cp\u003EClick \u003Cb\u003EImport CSV\u003C/b\u003E and choose a file (up to 3 MB). The first row names the columns: \u003Ccode\u003Eid\u003C/code\u003E (required), \u003Ccode\u003Ename\u003C/code\u003E, and any others, which are kept as the account\u0027s details (up to 20). An account that\u0027s already there is updated, and its details are replaced by the file\u0027s. When it finishes you see how many were added and updated, and which lines were skipped and why.\u003C/p\u003E\u003Cdiv class=\u0022code_wrapper\u0022\u003E\u003Cdiv class=\u0022code\u0022 data-language=\u0022plaintext\u0022\u003Eid,name,plan\nacme-42,Acme Corp,Growth\nglobex,Globex,Starter\u003C/div\u003E\u003C/div\u003E\u003Ch2 id=\u0022accounts_in_the_inbox\u0022\u003EAccounts in the inbox\u003C/h2\u003E\u003Cp\u003EOnce you have accounts, the \u003Ca href=\u0022/article/using-the-chat-inbox\u0022\u003Einbox\u003C/a\u003E shows each conversation\u0027s account under it in the list, and adds an account button (the building icon, \u003Cb\u003EShow one account\u003C/b\u003E) beside the search box. Pick an account to list only its conversations and tickets, in every view, until you clear it with the \u2715 on the bar above the list. In the ticket table, the \u003Cb\u003EAccount\u003C/b\u003E filter does the same; see \u003Ca href=\u0022/article/working-with-tickets\u0022\u003EWorking with Tickets\u003C/a\u003E.\u003C/p\u003E\u003Cp\u003EThe \u003Cb\u003EAccount\u003C/b\u003E row in a conversation\u0027s right-hand panel shows its account and how many open conversations that account has. Click \u2197 to see all of that account\u0027s conversations (or tickets, with \u003Ca href=\u0022/article/setting-up-ticketing\u0022\u003Eticketing\u003C/a\u003E on).\u003C/p\u003E\u003Ch3 id=\u0022move_a_conversation_to_another_account\u0022\u003EMove a conversation to another account\u003C/h3\u003E\u003Cp\u003EClick the account name in the \u003Cb\u003EAccount\u003C/b\u003E row (or \u003Cb\u003E\u002B Add to account\u003C/b\u003E when it has none) to open \u003Cb\u003EFile under an account\u003C/b\u003E, then pick one. You can also choose \u003Cb\u003ETake it out of\u003C/b\u003E its current account. Only that conversation moves: a signed-in customer stays in the account your website says they\u0027re in, so their next conversation is filed there again.\u003C/p\u003E\u003Ch3 id=\u0022emails_and_accounts\u0022\u003EEmails and accounts\u003C/h3\u003E\u003Cp\u003EAn email is filed under an account only when the sender\u0027s address is verified (the email passed the sender\u0027s own domain checks) and matches a signed-in customer you\u0027ve verified, who belongs to that account. An email that can\u0027t be verified is never filed under anyone\u0027s account automatically, so nobody can reach a company\u0027s tickets by faking a From address. See \u003Ca href=\u0022/article/chat-email-channel\u0022\u003Ethe email channel\u003C/a\u003E. When you create a ticket yourself with \u003Cb\u003ENew ticket\u003C/b\u003E, you can choose its account.\u003C/p\u003E\u003Ch2 id=\u0022for_developers_the_accounts_and_tickets_apis\u0022\u003EFor developers: the accounts and tickets APIs\u003C/h2\u003E\u003Cp\u003EYour app can keep accounts in step and show each company its own tickets, using an API key. Create keys on the \u003Cb\u003EDevelopers\u003C/b\u003E page in the account sidebar; see \u003Ca href=\u0022/article/api-keys-and-the-rest-api\u0022\u003EAPI Keys and the REST API\u003C/a\u003E. These APIs work at the messenger level, so use a key that works on every project, not one limited to a single project. Send the key as \u003Ccode\u003EAuthorization: Bearer \u0026lt;API key\u0026gt;\u003C/code\u003E. \u003Ccode\u003E{messenger}\u003C/code\u003E is your messenger\u0027s app id, and \u003Ccode\u003E{id}\u003C/code\u003E is your id for the account.\u003C/p\u003E\u003Ch3 id=\u0022sync_accounts\u0022\u003ESync accounts\u003C/h3\u003E\u003Ctable border=\u00221\u0022 style=\u0022border-collapse: collapse; width: 100%;\u0022\u003E\u003Cthead\u003E\u003Ctr\u003E\u003Cth\u003ERequest\u003C/th\u003E\u003Cth\u003EPermission\u003C/th\u003E\u003Cth\u003EWhat it does\u003C/th\u003E\u003C/tr\u003E\u003C/thead\u003E\u003Ctr\u003E\u003Ctd\u003E\u003Ccode\u003EGET /api/v1/messengers/{messenger}/accounts?q=\u0026amp;skip=\u0026amp;take=\u003C/code\u003E\u003C/td\u003E\u003Ctd\u003E\u003Ccode\u003Eproject:read\u003C/code\u003E or \u003Ccode\u003Eproject:write\u003C/code\u003E\u003C/td\u003E\u003Ctd\u003ELists accounts, optionally matching \u003Ccode\u003Eq\u003C/code\u003E (up to 200 a page).\u003C/td\u003E\u003C/tr\u003E\u003Ctr\u003E\u003Ctd\u003E\u003Ccode\u003EPOST /api/v1/messengers/{messenger}/accounts\u003C/code\u003E\u003C/td\u003E\u003Ctd\u003E\u003Ccode\u003Eproject:write\u003C/code\u003E\u003C/td\u003E\u003Ctd\u003EAdds or updates up to 500 accounts by your id. Returns how many were created and updated, and any that were skipped.\u003C/td\u003E\u003C/tr\u003E\u003Ctr\u003E\u003Ctd\u003E\u003Ccode\u003EDELETE /api/v1/messengers/{messenger}/accounts/{id}\u003C/code\u003E\u003C/td\u003E\u003Ctd\u003E\u003Ccode\u003Eproject:write\u003C/code\u003E\u003C/td\u003E\u003Ctd\u003EDeletes an account. Its people and conversations are kept.\u003C/td\u003E\u003C/tr\u003E\u003C/table\u003E\u003Cdiv class=\u0022code_wrapper\u0022\u003E\u003Cdiv class=\u0022code\u0022 data-language=\u0022http\u0022\u003EPOST https://trydocent.ai/api/v1/messengers/{messenger}/accounts\nAuthorization: Bearer \u0026lt;API key\u0026gt;\nContent-Type: application/json\n\n{ \u0026quot;accounts\u0026quot;: [ { \u0026quot;id\u0026quot;: \u0026quot;acme-42\u0026quot;, \u0026quot;name\u0026quot;: \u0026quot;Acme Corp\u0026quot;, \u0026quot;attributes\u0026quot;: { \u0026quot;plan\u0026quot;: \u0026quot;Growth\u0026quot; } } ] }\u003C/div\u003E\u003C/div\u003E\u003Cp\u003ESend every account once, then each one when it\u0027s added or renamed. Leaving out \u003Ccode\u003Ename\u003C/code\u003E or \u003Ccode\u003Eattributes\u003C/code\u003E keeps what\u0027s stored. The exact address, with your messenger\u0027s id filled in, is shown at the bottom of the \u003Cb\u003EAccounts\u003C/b\u003E page.\u003C/p\u003E\u003Ch3 id=\u0022tickets_for_an_account\u0022\u003ETickets for an account\u003C/h3\u003E\u003Cp\u003EShow a company its tickets inside your own app. Every request is limited to the account in the address: a ticket that belongs to another account answers \u0022not found\u0022. Only what the customer saw is returned, never internal notes or your team\u0027s ticket fields.\u003C/p\u003E\u003Ctable border=\u00221\u0022 style=\u0022border-collapse: collapse; width: 100%;\u0022\u003E\u003Cthead\u003E\u003Ctr\u003E\u003Cth\u003ERequest\u003C/th\u003E\u003Cth\u003EPermission\u003C/th\u003E\u003Cth\u003EWhat it does\u003C/th\u003E\u003C/tr\u003E\u003C/thead\u003E\u003Ctr\u003E\u003Ctd\u003E\u003Ccode\u003EGET /api/v1/messengers/{messenger}/accounts/{id}/tickets?status=\u0026amp;skip=\u0026amp;take=\u003C/code\u003E\u003C/td\u003E\u003Ctd\u003E\u003Ccode\u003Echat:read\u003C/code\u003E\u003C/td\u003E\u003Ctd\u003ELists the account\u0027s tickets, most recently active first (up to 200 a page). \u003Ccode\u003Estatus\u003C/code\u003E is \u003Ccode\u003Eactive\u003C/code\u003E (open, pending or on hold; the default), \u003Ccode\u003Eopen\u003C/code\u003E, \u003Ccode\u003Epending\u003C/code\u003E, \u003Ccode\u003Ehold\u003C/code\u003E, \u003Ccode\u003Esolved\u003C/code\u003E, \u003Ccode\u003Eclosed\u003C/code\u003E or \u003Ccode\u003Eany\u003C/code\u003E.\u003C/td\u003E\u003C/tr\u003E\u003Ctr\u003E\u003Ctd\u003E\u003Ccode\u003EGET \u2026/accounts/{id}/tickets/{number}\u003C/code\u003E\u003C/td\u003E\u003Ctd\u003E\u003Ccode\u003Echat:read\u003C/code\u003E\u003C/td\u003E\u003Ctd\u003EOne ticket (for #1042, use 1042) with its messages.\u003C/td\u003E\u003C/tr\u003E\u003Ctr\u003E\u003Ctd\u003E\u003Ccode\u003EPOST \u2026/accounts/{id}/tickets/{number}/messages\u003C/code\u003E\u003C/td\u003E\u003Ctd\u003E\u003Ccode\u003Echat:write\u003C/code\u003E\u003C/td\u003E\u003Ctd\u003EAdds a message from the customer: \u003Ccode\u003Ebody\u003C/code\u003E (text) or \u003Ccode\u003Ehtml\u003C/code\u003E, and \u003Ccode\u003Eauthor\u003C/code\u003E with \u003Ccode\u003Ename\u003C/code\u003E and \u003Ccode\u003Eemail\u003C/code\u003E of the person writing. Your team is alerted as for any customer reply, and a Pending, Solved or Closed ticket goes back to Open.\u003C/td\u003E\u003C/tr\u003E\u003Ctr\u003E\u003Ctd\u003E\u003Ccode\u003EPOST \u2026/accounts/{id}/tickets/{number}/reopen\u003C/code\u003E\u003C/td\u003E\u003Ctd\u003E\u003Ccode\u003Echat:write\u003C/code\u003E\u003C/td\u003E\u003Ctd\u003EReopens a Pending, Solved or Closed ticket. Send \u003Ccode\u003Eauthor\u003C/code\u003E so the ticket\u0027s history says who reopened it.\u003C/td\u003E\u003C/tr\u003E\u003C/table\u003E\u003Cdiv class=\u0022code_wrapper\u0022\u003E\u003Cdiv class=\u0022code\u0022 data-language=\u0022http\u0022\u003EPOST https://trydocent.ai/api/v1/messengers/{messenger}/accounts/acme-42/tickets/1042/messages\nAuthorization: Bearer \u0026lt;API key\u0026gt;\nContent-Type: application/json\n\n{ \u0026quot;body\u0026quot;: \u0026quot;This is still happening after the update.\u0026quot;, \u0026quot;author\u0026quot;: { \u0026quot;name\u0026quot;: \u0026quot;Jane Doe\u0026quot;, \u0026quot;email\u0026quot;: \u0026quot;jane@example.com\u0026quot; } }\u003C/div\u003E\u003C/div\u003E","publish_status":0,"post_type":"Article","author":{},"featured_image_updating":false,"meta_description":"Learn how to add, manage, and sync customer accounts in Chat, file conversations under accounts, and use the API to show companies their tickets.","display_toc":true,"has_workingcopy":false,"allow_indexing":true,"total_views":0,"date_published":"2026-11-15T17:38:28.967","date_updated":"2026-11-15T17:38:29.967","date_created":"2026-11-15T14:16:12.213"}}}