Companies
Managing company profiles and associations
Companies
Associate visitors with companies for B2B support scenarios.
Overview
Companies allow you to:
- Group users by organization
- View all conversations from a company
- Track company-level attributes
- Prioritize enterprise customers
Associating Users with Companies
Via Widget SDK
TransactionalSupport('identify', 'user-123', {
name: 'John Doe',
email: 'john@acme.com'
});
// Associate with a company
TransactionalSupport('company', 'company-456', {
name: 'Acme Inc',
plan: 'enterprise',
size: '100-500',
industry: 'Technology',
website: 'https://acme.com'
});Via API
const response = await fetch('/api/support/companies', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': 'your-api-key',
},
body: JSON.stringify({
id: 'company-456', // Your internal company ID
name: 'Acme Inc',
attributes: {
plan: 'enterprise',
size: '100-500',
industry: 'Technology',
website: 'https://acme.com',
mrr: 5000
}
}),
});Associate Visitor with Company
const response = await fetch('/api/support/visitors/{visitorId}/company', {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
'X-API-Key': 'your-api-key',
},
body: JSON.stringify({
companyId: 'company-456'
}),
});Company Profile
View in Dashboard
- Navigate to Support > Companies
- Search for a company
- Click to view profile
Profile Contains
- Company Info: Name, website, industry
- People: All associated users
- Conversations: All conversations from company users
- Attributes: Custom data (plan, MRR, etc.)
- Notes: Internal notes about the company
API Operations
Create Company
const response = await fetch('/api/support/companies', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': 'your-api-key',
},
body: JSON.stringify({
id: 'company-456',
name: 'Acme Inc',
attributes: {
plan: 'enterprise',
size: '100-500',
industry: 'Technology'
}
}),
});Get Company
const response = await fetch('/api/support/companies/{companyId}', {
headers: {
'X-API-Key': 'your-api-key',
},
});
const { data } = await response.json();Response:
{
data: {
id: 'company-456',
name: 'Acme Inc',
website: 'https://acme.com',
industry: 'Technology',
size: '100-500',
attributes: {
plan: 'enterprise',
mrr: 5000,
accountManager: 'Jane Smith'
},
userCount: 15,
conversationCount: 45,
createdAt: '2024-01-01T10:00:00Z',
updatedAt: '2024-01-15T10:00:00Z'
}
}List Companies
const response = await fetch('/api/support/companies', {
headers: {
'X-API-Key': 'your-api-key',
},
});
const { data, meta } = await response.json();Query parameters:
| Parameter | Type | Description |
|---|---|---|
search | string | Search by name |
industry | string | Filter by industry |
plan | string | Filter by plan attribute |
page | number | Page number |
limit | number | Items per page |
Update Company
const response = await fetch('/api/support/companies/{companyId}', {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
'X-API-Key': 'your-api-key',
},
body: JSON.stringify({
name: 'Acme Corporation',
attributes: {
plan: 'enterprise-plus',
mrr: 10000
}
}),
});Delete Company
const response = await fetch('/api/support/companies/{companyId}', {
method: 'DELETE',
headers: {
'X-API-Key': 'your-api-key',
},
});List Company Users
const response = await fetch('/api/support/companies/{companyId}/users', {
headers: {
'X-API-Key': 'your-api-key',
},
});
const { data } = await response.json();List Company Conversations
const response = await fetch('/api/support/companies/{companyId}/conversations', {
headers: {
'X-API-Key': 'your-api-key',
},
});
const { data } = await response.json();Company Attributes
Standard Attributes
| Attribute | Type | Description |
|---|---|---|
name | string | Company name |
website | string | Company website |
industry | string | Industry category |
size | string | Employee count range |
Custom Attributes
Add any custom attributes:
TransactionalSupport('company', 'company-456', {
name: 'Acme Inc',
// Custom attributes
plan: 'enterprise',
mrr: 5000,
contractEndDate: '2025-01-01',
accountManager: 'Jane Smith',
healthScore: 85,
npsScore: 9,
lastReviewDate: '2024-06-01',
features: ['analytics', 'api', 'sso']
});Priority Routing
Route conversations based on company attributes:
By Plan
{
routingRules: [
{
condition: { company: { plan: 'enterprise' } },
inboxId: 'priority-inbox',
assignTo: 'enterprise-team'
}
]
}By MRR
{
routingRules: [
{
condition: { company: { mrr: { greaterThan: 1000 } } },
inboxId: 'priority-inbox'
}
]
}Company Notes
Add internal notes about companies:
const response = await fetch('/api/support/companies/{companyId}/notes', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': 'your-api-key',
},
body: JSON.stringify({
content: 'Contract renewal coming up in Q1. Schedule call with account manager.'
}),
});Company Analytics
Get Company Stats
const response = await fetch('/api/support/companies/{companyId}/stats', {
headers: {
'X-API-Key': 'your-api-key',
},
});
const { data } = await response.json();Response:
{
data: {
totalConversations: 45,
openConversations: 3,
avgResponseTime: 300, // seconds
avgResolutionTime: 7200, // seconds
csat: 4.2,
topIssues: [
{ tag: 'billing', count: 10 },
{ tag: 'feature-request', count: 8 }
]
}
}Segmentation
Create company segments:
const response = await fetch('/api/support/company-segments', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': 'your-api-key',
},
body: JSON.stringify({
name: 'Enterprise Customers',
conditions: [
{ field: 'attributes.plan', operator: 'equals', value: 'enterprise' }
]
}),
});Syncing from CRM
Keep company data in sync with your CRM:
Webhook Integration
// In your CRM webhook handler
app.post('/webhook/crm', async (req, res) => {
const { type, company } = req.body;
if (type === 'company.updated') {
await fetch('https://api.usetransactional.com/support/companies/' + company.id, {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
'X-API-Key': process.env.TRANSACTIONAL_API_KEY,
},
body: JSON.stringify({
name: company.name,
attributes: {
plan: company.plan,
mrr: company.mrr,
accountManager: company.owner.name
}
}),
});
}
res.status(200).json({ received: true });
});Next Steps
- Visitors - Managing visitors
- Conversations - Managing conversations
- API Reference - Full API documentation
On This Page
- Overview
- Associating Users with Companies
- Via Widget SDK
- Via API
- Associate Visitor with Company
- Company Profile
- View in Dashboard
- Profile Contains
- API Operations
- Create Company
- Get Company
- List Companies
- Update Company
- Delete Company
- List Company Users
- List Company Conversations
- Company Attributes
- Standard Attributes
- Custom Attributes
- Priority Routing
- By Plan
- By MRR
- Company Notes
- Company Analytics
- Get Company Stats
- Segmentation
- Syncing from CRM
- Webhook Integration
- Next Steps