@@ -3,9 +3,9 @@ python-intercom
3
3
4
4
|PyPI Version | |PyPI Downloads | |Travis CI Build | |Coverage Status |
5
5
6
- Python bindings for the Intercom API (https://api .intercom.io ).
6
+ Python bindings for the Intercom API (https://developers .intercom.com/intercom-api-reference ).
7
7
8
- `API Documentation <https://developers.intercom.com/reference >`__.
8
+ `API Documentation <https://developers.intercom.com/intercom-api-reference/ reference >`__.
9
9
10
10
`Package
11
11
Documentation <http://readthedocs.org/docs/python-intercom/> `__.
89
89
for user in intercom.users.all():
90
90
...
91
91
92
- # Bulk operations.
93
- # Submit bulk job, to create users, if any of the items in create_items match an existing user that user will be updated
94
- intercom.users.submit_bulk_job(create_items = [{' user_id' : 25 , ' email' : ' alice@example.com' }, {' user_id' : 25 , ' email' : ' bob@example.com' }])
95
- # Submit bulk job, to delete users
96
- intercom.users.submit_bulk_job(delete_items = [{' user_id' : 25 , ' email' : ' alice@example.com' }, {' user_id' : 25 , ' email' : ' bob@example.com' }])
97
- # Submit bulk job, to add items to existing job
98
- intercom.users.submit_bulk_job(create_items = [{' user_id' : 25 , ' email' : ' alice@example.com' }], delete_items = [{' user_id' : 25 , ' email' : ' bob@example.com' }], ' job_id' : ' job_abcd1234' )
99
-
100
92
Admins
101
93
^^^^^^
102
94
@@ -348,9 +340,11 @@ Events
348
340
349
341
.. code:: python
350
342
343
+ import time
344
+
351
345
intercom.events.create(
352
346
event_name = ' invited-friend' ,
353
- created_at = time.mktime(time.localtime()),
347
+ created_at = int ( time.mktime(time.localtime() )),
354
348
email = user.email,
355
349
metadata = {
356
350
' invitee_email' : ' pi@example.org' ,
@@ -367,6 +361,8 @@ your behalf
367
361
368
362
.. code:: python
369
363
364
+ current_user = intercom.users.find(id = " 1" )
365
+
370
366
intercom.events.create(
371
367
event_name = " placed-order" ,
372
368
email = current_user.email,
@@ -394,54 +390,6 @@ The metadata key values in the example are treated as follows-
394
390
- price: An Amount in US Dollars (value contains ' amount' and
395
391
' currency' keys)
396
392
397
- Bulk operations.
398
-
399
- .. code :: python
400
-
401
- # Submit bulk job, to create events
402
- intercom.events.submit_bulk_job(create_items: [
403
- {
404
- ' event_name' : ' ordered-item' ,
405
- ' created_at' : 1438944980 ,
406
- ' user_id' : ' 314159' ,
407
- ' metadata' : {
408
- ' order_date' : 1438944980 ,
409
- ' stripe_invoice' : ' inv_3434343434'
410
- }
411
- },
412
- {
413
- ' event_name' : ' invited-friend' ,
414
- ' created_at' : 1438944979 ,
415
- ' user_id' : ' 314159' ,
416
- ' metadata' : {
417
- ' invitee_email' : ' pi@example.org' ,
418
- ' invite_code' : ' ADDAFRIEND'
419
- }
420
- }
421
- ])
422
-
423
- # Submit bulk job, to add items to existing job
424
- intercom.events.submit_bulk_job(create_items = [
425
- {
426
- ' event_name' : ' ordered-item' ,
427
- ' created_at' : 1438944980 ,
428
- ' user_id' : ' 314159' ,
429
- ' metadata' : {
430
- ' order_date' : 1438944980 ,
431
- ' stripe_invoice' : ' inv_3434343434'
432
- }
433
- },
434
- {
435
- ' event_name' : ' invited-friend' ,
436
- ' created_at' : 1438944979 ,
437
- ' user_id' : " 314159" ,
438
- ' metadata' : {
439
- ' invitee_email' : ' pi@example.org' ,
440
- ' invite_code' : ' ADDAFRIEND'
441
- }
442
- }
443
- ], job_id = ' job_abcd1234' )
444
-
445
393
Contacts
446
394
^^^^^^^^
447
395
@@ -450,20 +398,21 @@ Contacts represent logged out users of your application.
450
398
.. code :: python
451
399
452
400
# Create a contact
453
- contact = intercom.contacts .create(email = " some_contact@example.com" )
401
+ contact = intercom.leads .create(email = " some_contact@example.com" )
454
402
455
403
# Update a contact
456
404
contact.custom_attributes[' foo' ] = ' bar'
457
- intercom.contacts .save(contact)
405
+ intercom.leads .save(contact)
458
406
459
407
# Find contacts by email
460
- contacts = intercom.contacts .find_all(email = " some_contact@example.com" )
408
+ contacts = intercom.leads .find_all(email = " some_contact@example.com" )
461
409
462
- # Convert a contact into a user
463
- intercom.contacts.convert(contact, user)
410
+ # Merge a contact into a user
411
+ user = intercom.users.find(id = " 1" )
412
+ intercom.leads.convert(contact, user)
464
413
465
414
# Delete a contact
466
- intercom.contacts .delete(contact)
415
+ intercom.leads .delete(contact)
467
416
468
417
Counts
469
418
^^^^^^
@@ -493,17 +442,6 @@ Subscribe to events in Intercom to receive webhooks.
493
442
intercom.subscriptions.all():
494
443
...
495
444
496
- Bulk jobs
497
- ^^^^^^^^^
498
-
499
- .. code :: python
500
-
501
- # fetch a job
502
- intercom.jobs.find(id = ' job_abcd1234' )
503
-
504
- # fetch a job's error feed
505
- intercom.jobs.errors(id = ' job_abcd1234' )
506
-
507
445
Errors
508
446
~~~~~~
509
447
0 commit comments