@23blocks/block-crm 3.0.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +268 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
# @23blocks/block-crm
|
|
2
|
+
|
|
3
|
+
CRM block for the 23blocks SDK - accounts, contacts, leads, opportunities, meetings, and more.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@23blocks/block-crm)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install @23blocks/block-crm @23blocks/transport-http
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Overview
|
|
15
|
+
|
|
16
|
+
This package provides comprehensive CRM functionality including:
|
|
17
|
+
|
|
18
|
+
- **Accounts** - Company/organization management with documents
|
|
19
|
+
- **Contacts** - Contact management with profiles and events
|
|
20
|
+
- **Leads** - Lead tracking and follow-ups
|
|
21
|
+
- **Opportunities** - Sales pipeline management
|
|
22
|
+
- **Meetings** - Meeting scheduling with participants and billing
|
|
23
|
+
- **Quotes** - Quote generation and management
|
|
24
|
+
- **Subscribers** - Newsletter/subscription management
|
|
25
|
+
- **Referrals** - Referral tracking
|
|
26
|
+
- **Touches** - Interaction logging
|
|
27
|
+
- **Calendar** - Calendar integration with Zoom support
|
|
28
|
+
|
|
29
|
+
## Quick Start
|
|
30
|
+
|
|
31
|
+
```typescript
|
|
32
|
+
import { createHttpTransport } from '@23blocks/transport-http';
|
|
33
|
+
import { createCrmBlock } from '@23blocks/block-crm';
|
|
34
|
+
|
|
35
|
+
const transport = createHttpTransport({
|
|
36
|
+
baseUrl: 'https://api.yourapp.com',
|
|
37
|
+
headers: () => {
|
|
38
|
+
const token = localStorage.getItem('access_token');
|
|
39
|
+
return token ? { Authorization: `Bearer ${token}` } : {};
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const crm = createCrmBlock(transport, {
|
|
44
|
+
apiKey: 'your-api-key',
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
// List contacts
|
|
48
|
+
const { data: contacts } = await crm.contacts.list({ limit: 20 });
|
|
49
|
+
|
|
50
|
+
// Create a lead
|
|
51
|
+
const lead = await crm.leads.create({
|
|
52
|
+
firstName: 'John',
|
|
53
|
+
lastName: 'Doe',
|
|
54
|
+
email: 'john@example.com',
|
|
55
|
+
source: 'website',
|
|
56
|
+
});
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Services
|
|
60
|
+
|
|
61
|
+
### accounts - Account Management
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
// List accounts
|
|
65
|
+
const { data: accounts } = await crm.accounts.list({ limit: 20 });
|
|
66
|
+
|
|
67
|
+
// Get account by ID
|
|
68
|
+
const account = await crm.accounts.get('account-id');
|
|
69
|
+
|
|
70
|
+
// Create account
|
|
71
|
+
const newAccount = await crm.accounts.create({
|
|
72
|
+
name: 'Acme Corp',
|
|
73
|
+
industry: 'Technology',
|
|
74
|
+
website: 'https://acme.com',
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
// Update account
|
|
78
|
+
await crm.accounts.update('account-id', { industry: 'Software' });
|
|
79
|
+
|
|
80
|
+
// Delete account
|
|
81
|
+
await crm.accounts.delete('account-id');
|
|
82
|
+
|
|
83
|
+
// Account documents
|
|
84
|
+
const { data: docs } = await crm.accounts.listDocuments('account-id');
|
|
85
|
+
await crm.accounts.addDocument('account-id', { name: 'Contract', fileId: 'file-id' });
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### contacts - Contact Management
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
// List contacts
|
|
92
|
+
const { data: contacts } = await crm.contacts.list({ accountId: 'account-id' });
|
|
93
|
+
|
|
94
|
+
// Create contact
|
|
95
|
+
const contact = await crm.contacts.create({
|
|
96
|
+
firstName: 'Jane',
|
|
97
|
+
lastName: 'Smith',
|
|
98
|
+
email: 'jane@example.com',
|
|
99
|
+
accountId: 'account-id',
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
// Update contact
|
|
103
|
+
await crm.contacts.update('contact-id', { phone: '+1234567890' });
|
|
104
|
+
|
|
105
|
+
// Get contact profile
|
|
106
|
+
const profile = await crm.contacts.getProfile('contact-id');
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### contactEvents - Contact Events
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
// List events for contact
|
|
113
|
+
const { data: events } = await crm.contactEvents.list({ contactId: 'contact-id' });
|
|
114
|
+
|
|
115
|
+
// Create event
|
|
116
|
+
const event = await crm.contactEvents.create({
|
|
117
|
+
contactId: 'contact-id',
|
|
118
|
+
eventType: 'meeting',
|
|
119
|
+
scheduledAt: '2024-12-01T10:00:00Z',
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
// Confirm event
|
|
123
|
+
await crm.contactEvents.confirm('event-id', { confirmed: true });
|
|
124
|
+
|
|
125
|
+
// Check in/out
|
|
126
|
+
await crm.contactEvents.checkin('event-id', { checkedInAt: new Date().toISOString() });
|
|
127
|
+
await crm.contactEvents.checkout('event-id', { checkedOutAt: new Date().toISOString() });
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### leads - Lead Management
|
|
131
|
+
|
|
132
|
+
```typescript
|
|
133
|
+
// List leads
|
|
134
|
+
const { data: leads } = await crm.leads.list({ status: 'new' });
|
|
135
|
+
|
|
136
|
+
// Create lead
|
|
137
|
+
const lead = await crm.leads.create({
|
|
138
|
+
firstName: 'John',
|
|
139
|
+
lastName: 'Doe',
|
|
140
|
+
email: 'john@example.com',
|
|
141
|
+
source: 'website',
|
|
142
|
+
status: 'new',
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
// Update lead status
|
|
146
|
+
await crm.leads.update('lead-id', { status: 'qualified' });
|
|
147
|
+
|
|
148
|
+
// Convert lead to contact
|
|
149
|
+
await crm.leads.convert('lead-id', { accountId: 'account-id' });
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### leadFollows - Lead Follow-ups
|
|
153
|
+
|
|
154
|
+
```typescript
|
|
155
|
+
// List follow-ups
|
|
156
|
+
const { data: follows } = await crm.leadFollows.list({ leadId: 'lead-id' });
|
|
157
|
+
|
|
158
|
+
// Create follow-up
|
|
159
|
+
const follow = await crm.leadFollows.create({
|
|
160
|
+
leadId: 'lead-id',
|
|
161
|
+
followType: 'call',
|
|
162
|
+
scheduledAt: '2024-12-01T10:00:00Z',
|
|
163
|
+
notes: 'Initial call',
|
|
164
|
+
});
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### opportunities - Opportunity Management
|
|
168
|
+
|
|
169
|
+
```typescript
|
|
170
|
+
// List opportunities
|
|
171
|
+
const { data: opps } = await crm.opportunities.list({ stage: 'negotiation' });
|
|
172
|
+
|
|
173
|
+
// Create opportunity
|
|
174
|
+
const opp = await crm.opportunities.create({
|
|
175
|
+
name: 'Enterprise Deal',
|
|
176
|
+
accountId: 'account-id',
|
|
177
|
+
stage: 'discovery',
|
|
178
|
+
value: 50000,
|
|
179
|
+
closeDate: '2024-12-31',
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
// Update stage
|
|
183
|
+
await crm.opportunities.update('opp-id', { stage: 'closed_won' });
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### meetings - Meeting Management
|
|
187
|
+
|
|
188
|
+
```typescript
|
|
189
|
+
// List meetings
|
|
190
|
+
const { data: meetings } = await crm.meetings.list({ startDate: '2024-12-01' });
|
|
191
|
+
|
|
192
|
+
// Create meeting
|
|
193
|
+
const meeting = await crm.meetings.create({
|
|
194
|
+
title: 'Sales Review',
|
|
195
|
+
startTime: '2024-12-01T10:00:00Z',
|
|
196
|
+
endTime: '2024-12-01T11:00:00Z',
|
|
197
|
+
accountId: 'account-id',
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
// Add participant
|
|
201
|
+
await crm.meetingParticipants.create({
|
|
202
|
+
meetingId: 'meeting-id',
|
|
203
|
+
contactId: 'contact-id',
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
// Meeting billing
|
|
207
|
+
await crm.meetingBillings.create({
|
|
208
|
+
meetingId: 'meeting-id',
|
|
209
|
+
amount: 100,
|
|
210
|
+
payerId: 'payer-id',
|
|
211
|
+
});
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### quotes - Quote Management
|
|
215
|
+
|
|
216
|
+
```typescript
|
|
217
|
+
// List quotes
|
|
218
|
+
const { data: quotes } = await crm.quotes.list({ opportunityId: 'opp-id' });
|
|
219
|
+
|
|
220
|
+
// Create quote
|
|
221
|
+
const quote = await crm.quotes.create({
|
|
222
|
+
opportunityId: 'opp-id',
|
|
223
|
+
name: 'Q-2024-001',
|
|
224
|
+
validUntil: '2024-12-31',
|
|
225
|
+
items: [{ productId: 'prod-id', quantity: 1, price: 1000 }],
|
|
226
|
+
});
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### Calendar Integration
|
|
230
|
+
|
|
231
|
+
```typescript
|
|
232
|
+
// List calendar accounts
|
|
233
|
+
const { data: calendars } = await crm.calendarAccounts.list();
|
|
234
|
+
|
|
235
|
+
// Sync calendar
|
|
236
|
+
await crm.calendarAccounts.sync('calendar-id');
|
|
237
|
+
|
|
238
|
+
// Create busy block
|
|
239
|
+
await crm.busyBlocks.create({
|
|
240
|
+
startTime: '2024-12-01T12:00:00Z',
|
|
241
|
+
endTime: '2024-12-01T13:00:00Z',
|
|
242
|
+
reason: 'Lunch',
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
// Zoom integration
|
|
246
|
+
const { data: hosts } = await crm.zoomHosts.list();
|
|
247
|
+
await crm.zoomMeetings.provision({ hostId: 'host-id', meetingId: 'meeting-id' });
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
## Types
|
|
251
|
+
|
|
252
|
+
```typescript
|
|
253
|
+
import type {
|
|
254
|
+
Account, Contact, Lead, Opportunity, Meeting, Quote,
|
|
255
|
+
CreateAccountRequest, CreateContactRequest, CreateLeadRequest,
|
|
256
|
+
CreateOpportunityRequest, CreateMeetingRequest, CreateQuoteRequest,
|
|
257
|
+
} from '@23blocks/block-crm';
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
## Related Packages
|
|
261
|
+
|
|
262
|
+
- [`@23blocks/angular`](https://www.npmjs.com/package/@23blocks/angular) - Angular integration
|
|
263
|
+
- [`@23blocks/react`](https://www.npmjs.com/package/@23blocks/react) - React integration
|
|
264
|
+
- [`@23blocks/sdk`](https://www.npmjs.com/package/@23blocks/sdk) - Full SDK package
|
|
265
|
+
|
|
266
|
+
## License
|
|
267
|
+
|
|
268
|
+
MIT - Copyright (c) 2024 23blocks
|
package/package.json
CHANGED