@@ -45,8 +45,7 @@ Intercom documentation: `Create or Update Users <https://developers.intercom.io/
45
45
46
46
::
47
47
48
- from intercom import User
49
- User.create(user_id='1234', email='bob@example.com')
48
+ intercom.users.create(user_id='1234', email='bob@example.com')
50
49
51
50
Updating the Last Seen Time
52
51
+++++++++++++++++++++++++++
@@ -55,7 +54,7 @@ Intercom documentation: `Updating the Last Seen Time <https://developers.interco
55
54
56
55
::
57
56
58
- user = User. create(used_id='25', last_request_at=datetime.now ())
57
+ user = intercom.users. create(used_id='25', last_request_at=datetime.utcnow ())
59
58
60
59
List Users
61
60
++++++++++
@@ -64,7 +63,7 @@ Intercom documentation: `List Users <https://developers.intercom.io/reference#li
64
63
65
64
::
66
65
67
- for user in User .all():
66
+ for user in intercom.users .all():
68
67
...
69
68
70
69
List by Tag, Segment, Company
@@ -75,10 +74,10 @@ Intercom documentation: `List by Tag, Segment, Company <https://developers.inter
75
74
::
76
75
77
76
# tag request
78
- User .find_all(tag_id='30126')
77
+ intercom.users .find_all(tag_id='30126')
79
78
80
79
# segment request
81
- User .find_all(segment_id='30126')
80
+ intercom.users .find_all(segment_id='30126')
82
81
83
82
84
83
View a User
@@ -89,13 +88,13 @@ Intercom documentation: `View a User <https://developers.intercom.io/reference#v
89
88
::
90
89
91
90
# ID request
92
- User .find(id='1')
91
+ intercom.users .find(id='1')
93
92
94
93
# User ID request
95
- User .find(user_id='1')
94
+ intercom.users .find(user_id='1')
96
95
97
96
# Email request
98
- User .find(email='bob@example.com')
97
+ intercom.users .find(email='bob@example.com')
99
98
100
99
Delete a User
101
100
+++++++++++++
@@ -105,13 +104,13 @@ Intercom documentation: `Deleting a User <https://developers.intercom.io/referen
105
104
::
106
105
107
106
# ID Delete Request
108
- deleted_user = User .find(id='1').delete()
107
+ deleted_user = intercom.users .find(id='1').delete()
109
108
110
109
# User ID Delete Request
111
- deleted_user = User .find(user_id='1').delete()
110
+ deleted_user = intercom.users .find(user_id='1').delete()
112
111
113
112
# Email Delete Request
114
- deleted_user = User .find(email='bob@example.com').delete()
113
+ deleted_user = intercom.users .find(email='bob@example.com').delete()
115
114
116
115
117
116
Companies
@@ -124,7 +123,7 @@ Intercom documentation: `Create or Update Company <https://developers.intercom.i
124
123
125
124
::
126
125
127
- Company .create(company_id=6, name="Blue Sun", plan="Paid")
126
+ intercom.companies .create(company_id=6, name="Blue Sun", plan="Paid")
128
127
129
128
List Companies
130
129
++++++++++++++
@@ -133,7 +132,7 @@ Intercom documentation: `List Companies <https://developers.intercom.io/referenc
133
132
134
133
::
135
134
136
- for company in Company .all():
135
+ for company in intercom.companies .all():
137
136
...
138
137
139
138
List by Tag or Segment
@@ -144,10 +143,10 @@ Intercom documentation: `List by Tag or Segment <https://developers.intercom.io/
144
143
::
145
144
146
145
# tag request
147
- Company .find(tag_id="1234")
146
+ intercom.companies .find(tag_id="1234")
148
147
149
148
# segment request
150
- Company .find(segment_id="4567")
149
+ intercom.companies .find(segment_id="4567")
151
150
152
151
View a Company
153
152
++++++++++++++
@@ -156,7 +155,7 @@ Intercom documentation: `View a Company <https://developers.intercom.io/referenc
156
155
157
156
::
158
157
159
- Company .find(id="41e66f0313708347cb0000d0")
158
+ intercom.companies .find(id="41e66f0313708347cb0000d0")
160
159
161
160
List Company Users
162
161
++++++++++++++++++
@@ -165,7 +164,7 @@ Intercom documentation: `List Company Users <https://developers.intercom.io/refe
165
164
166
165
::
167
166
168
- company = Company .find(id="41e66f0313708347cb0000d0")
167
+ company = intercom.companies .find(id="41e66f0313708347cb0000d0")
169
168
for user in company.users:
170
169
...
171
170
@@ -179,8 +178,7 @@ Intercom documentation: `List Admins <https://developers.intercom.io/reference#l
179
178
180
179
::
181
180
182
- from intercom import Admin
183
- for admin in Admin.all():
181
+ for admin in intercom.admins.all():
184
182
...
185
183
186
184
Tags
@@ -193,13 +191,11 @@ Intercom documentation: `Create and Update Tags <https://developers.intercom.io/
193
191
194
192
::
195
193
196
- from intercom import Tag
197
-
198
194
# Create Request
199
- tag = Tag .create(name='Independentt')
195
+ tag = intercom.tags .create(name='Independentt')
200
196
201
197
# Update Request
202
- Tag .tag_users(name='Independent', id=tag.id)
198
+ intercom.tags .tag_users(name='Independent', id=tag.id)
203
199
204
200
205
201
Tag or Untag Users & Companies
@@ -210,10 +206,10 @@ Intercom documentation: `Tag or Untag Users & Companies <https://developers.inte
210
206
::
211
207
212
208
# Multi-User Tag Request
213
- Tag .tag_users('Independent', ["42ea2f1b93891f6a99000427", "42ea2f1b93891f6a99000428"])
209
+ intercom.tags .tag_users('Independent', ["42ea2f1b93891f6a99000427", "42ea2f1b93891f6a99000428"])
214
210
215
211
# Untag Request
216
- Tag .untag_users('blue', ["42ea2f1b93891f6a99000427"])
212
+ intercom.tags .untag_users('blue', ["42ea2f1b93891f6a99000427"])
217
213
218
214
Delete a Tag
219
215
++++++++++++
@@ -222,7 +218,7 @@ Intercom documentation: `Delete a Tag <https://developers.intercom.io/reference#
222
218
223
219
::
224
220
225
- tag .delete()
221
+ intercom.tags .delete()
226
222
227
223
228
224
List Tags for an App
@@ -232,7 +228,7 @@ Intercom Documentation: `List Tags for an App <https://developers.intercom.io/re
232
228
233
229
::
234
230
235
- for tag in Tag.all():
231
+ for intercom.tags in Tag.all():
236
232
...
237
233
238
234
Segments
@@ -245,9 +241,7 @@ Intercom Documentation: `List Segments <https://developers.intercom.io/reference
245
241
246
242
::
247
243
248
- from intercom import Segment
249
-
250
- for segment in Segment.all():
244
+ for segment in intercom.segments.all():
251
245
...
252
246
253
247
View a Segment
@@ -257,7 +251,7 @@ Intercom Documentation: `View a Segment <https://developers.intercom.io/referenc
257
251
258
252
::
259
253
260
- Segment .find(id='1234')
254
+ intercom.segments .find(id='1234')
261
255
262
256
Notes
263
257
-----
@@ -269,9 +263,7 @@ Intercom documentation: `Create a Note <https://developers.intercom.io/reference
269
263
270
264
::
271
265
272
- from intercom import Note
273
-
274
- Note.create(email="joe@exampe.com", body="Text for the note")
266
+ intercom.notes.create(email="joe@exampe.com", body="Text for the note")
275
267
276
268
277
269
List Notes for a User
@@ -282,11 +274,11 @@ Intercom documentation: `List Notes for a User <https://developers.intercom.io/r
282
274
::
283
275
284
276
# User ID Request
285
- for note in Note .find_all(user_id='123'):
277
+ for note in intercom.notes .find_all(user_id='123'):
286
278
...
287
279
288
280
# User Email Request
289
- for note in Note .find_all(email='foo@bar.com'):
281
+ for note in intercom.notes .find_all(email='foo@bar.com'):
290
282
...
291
283
292
284
View a Note
@@ -296,7 +288,7 @@ Intercom documentation: `View a Note <https://developers.intercom.io/reference#v
296
288
297
289
::
298
290
299
- Note .find(id='1234')
291
+ intercom.notes .find(id='1234')
300
292
301
293
Events
302
294
------
@@ -308,8 +300,7 @@ Intercom documentation: `Submitting Events <https://developers.intercom.io/refer
308
300
309
301
::
310
302
311
- from intercom import Event
312
- Event.create(event_name="Eventful 1", email=user.email, created_at=1403001013)
303
+ intercom.events.create(event_name="Eventful 1", email=user.email, created_at=1403001013)
313
304
314
305
315
306
Counts
@@ -318,35 +309,27 @@ Counts
318
309
Getting counts
319
310
++++++++++++++
320
311
321
- Intercom documentation: `Creating a Tag <https://developers.intercom.io/reference#getting-counts >`_.
312
+ Intercom documentation: `Getting Counts <https://developers.intercom.io/reference#getting-counts >`_.
322
313
323
314
::
324
315
325
- from intercom import Count
326
-
327
316
# Conversation Admin Count
328
- Count.conversation_counts_for_each_admin
317
+ intercom.counts.for_type(type='converation', count='admin')
329
318
330
319
# User Tag Count
331
- Count.user_counts_for_each_tag
320
+ intercom.counts.for_type(type='user', count='tag')
332
321
333
322
# User Segment Count
334
- Count.user_counts_for_each_segment
335
-
336
- # Company Segment Count
337
- Count.company_counts_for_each_segment
338
-
323
+ intercom.counts.for_type(type='user', count='segment')
324
+
339
325
# Company Tag Count
340
- Count.company_counts_for_each_tag
341
-
326
+ intercom.counts.for_type(type='company', count='tag')
327
+
342
328
# Company User Count
343
- Count.company_counts_for_each_user
329
+ intercom.counts.for_type(type='company', count='user')
344
330
345
331
# Global App Counts
346
- Company.count
347
- User.count
348
- Segment.count
349
- Tag.count
332
+ intercom.counts.for_type()
350
333
351
334
Conversations
352
335
-------------
@@ -358,7 +341,6 @@ Intercom documentation: `Admin Initiated Conversation <https://developers.interc
358
341
359
342
::
360
343
361
- from intercom import Message
362
344
message_data = {
363
345
'message_type': 'email',
364
346
'subject': 'This Land',
@@ -373,7 +355,7 @@ Intercom documentation: `Admin Initiated Conversation <https://developers.interc
373
355
'id': "536e564f316c83104c000020"
374
356
}
375
357
}
376
- Message .create(**message_data)
358
+ intercom.messages .create(**message_data)
377
359
378
360
User Initiated Conversation
379
361
+++++++++++++++++++++++++++
@@ -389,7 +371,7 @@ Intercom documentation: `User Initiated Conversation <https://developers.interco
389
371
},
390
372
'body': "Hey"
391
373
}
392
- Message .create(**message_data)
374
+ intercom.messages .create(**message_data)
393
375
394
376
List Conversations
395
377
++++++++++++++++++
@@ -398,8 +380,7 @@ Intercom documentation: `List Conversations <https://developers.intercom.io/refe
398
380
399
381
::
400
382
401
- from intercom import Conversation
402
- Conversation.find_all(type='admin', id=25, open=True)
383
+ intercom.conversations.find_all(type='admin', id=25, open=True)
403
384
404
385
405
386
Get a Single Conversation
@@ -409,7 +390,7 @@ Intercom documentation: `Get a Single Conversation <https://developers.intercom.
409
390
410
391
::
411
392
412
- Conversation .find(id='147')
393
+ intercom.conversations .find(id='147')
413
394
414
395
Replying to a Conversation
415
396
++++++++++++++++++++++++++
@@ -442,8 +423,7 @@ Intercom documentation: `Manage Subscriptions <https://developers.intercom.io/re
442
423
443
424
::
444
425
445
- from intercom import Subscription
446
- Subscription.create(service_type='web', url='http://example.com', topics=['all'])
426
+ intercom.subscriptions.create(service_type='web', url='http://example.com', topics=['all'])
447
427
448
428
449
429
View a Subscription
@@ -453,7 +433,7 @@ Intercom documentation: `View a Subscription <https://developers.intercom.io/ref
453
433
454
434
::
455
435
456
- Subscription .find(id='123')
436
+ intercom.subscriptions .find(id='123')
457
437
458
438
List Subscriptions
459
439
++++++++++++++++++
@@ -462,7 +442,7 @@ Intercom documentation: `List Subscriptions <https://developers.intercom.io/refe
462
442
463
443
::
464
444
465
- for subscription in Subscription .all():
445
+ for subscription in intercom.subscriptions .all():
466
446
...
467
447
468
448
Development
0 commit comments