@@ -3,9 +3,9 @@ python-intercom
33
44|PyPI Version | |PyPI Downloads | |Travis CI Build | |Coverage Status |
55
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 ).
77
8- `API Documentation <https://developers.intercom.com/reference >`__.
8+ `API Documentation <https://developers.intercom.com/intercom-api-reference/ reference >`__.
99
1010`Package
1111Documentation <http://readthedocs.org/docs/python-intercom/> `__.
8989for userin intercom.users.all():
9090...
9191
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-
10092 Admins
10193^^^^^^
10294
@@ -348,9 +340,11 @@ Events
348340
349341.. code:: python
350342
343+ import time
344+
351345 intercom.events.create(
352346event_name = ' invited-friend' ,
353- created_at = time.mktime(time.localtime()),
347+ created_at = int ( time.mktime(time.localtime() )),
354348email = user.email,
355349metadata = {
356350' invitee_email' :' pi@example.org' ,
@@ -367,6 +361,8 @@ your behalf
367361
368362.. code:: python
369363
364+ current_user = intercom.users.find(id = " 1" )
365+
370366 intercom.events.create(
371367event_name = " placed-order" ,
372368email = current_user.email,
@@ -394,54 +390,6 @@ The metadata key values in the example are treated as follows-
394390- price: An Amountin US Dollars (value contains' amount' and
395391' currency' keys)
396392
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-
445393 Contacts
446394^^^^^^^^
447395
@@ -450,20 +398,21 @@ Contacts represent logged out users of your application.
450398..code ::python
451399
452400# Create a contact
453- contact= intercom.contacts .create(email = " some_contact@example.com" )
401+ contact= intercom.leads .create(email = " some_contact@example.com" )
454402
455403# Update a contact
456404 contact.custom_attributes[' foo' ]= ' bar'
457- intercom.contacts .save(contact)
405+ intercom.leads .save(contact)
458406
459407# 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" )
461409
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)
464413
465414# Delete a contact
466- intercom.contacts .delete(contact)
415+ intercom.leads .delete(contact)
467416
468417 Counts
469418^^^^^^
@@ -493,17 +442,6 @@ Subscribe to events in Intercom to receive webhooks.
493442 intercom.subscriptions.all():
494443...
495444
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-
507445 Errors
508446~~~~~~
509447