Skip to content

Commit 57074b1

Browse files
authored
Merge pull request #197 from apassant/master
Fix URLS and examples
2 parents c542f79 + d0d7b54 commit 57074b1

File tree

2 files changed

+33
-104
lines changed

2 files changed

+33
-104
lines changed

README.rst

Lines changed: 14 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -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
1111
Documentation <http://readthedocs.org/docs/python-intercom/>`__.
@@ -89,14 +89,6 @@ Users
8989
for user in 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(
352346
event_name='invited-friend',
353-
created_at=time.mktime(time.localtime()),
347+
created_at=int(time.mktime(time.localtime())),
354348
email=user.email,
355349
metadata={
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(
371367
event_name="placed-order",
372368
email=current_user.email,
@@ -394,54 +390,6 @@ The metadata key values in the example are treated as follows-
394390
- price: An Amount in 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

docs/index.rst

Lines changed: 19 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ python-intercom
1414
Installation
1515
============
1616

17-
Stable releases of python-intercom can be installed with
18-
`pip <http://pip.openplans.org>`_ or you may download a `.tgz` source
17+
Stable releases of python-intercom can be installed with
18+
`pip <http://pip.openplans.org>`_ or you may download a `.tgz` source
1919
archive from `pypi <http://pypi.python.org/pypi/python-intercom#downloads>`_.
2020
See the :doc:`installation` page for more detailed instructions.
2121

22-
If you want to use the latest code, you can grab it from our
22+
If you want to use the latest code, you can grab it from our
2323
`Git repository <http://github.com/jkeyes/python-intercom>`_, or `fork it <http://github.com/jkeyes/python-intercom>`_.
2424

2525
Usage
@@ -28,7 +28,7 @@ Usage
2828
Authorization
2929
-------------
3030

31-
Intercom documentation: `Personal Access Tokens <https://developers.intercom.com/reference#personal-access-tokens-1>`_.
31+
Intercom documentation: `Personal Access Tokens <https://developers.intercom.com/intercom-api-reference/reference#section-access-tokens>`_.
3232

3333
::
3434

@@ -75,7 +75,7 @@ Intercom documentation: `List by Tag, Segment, Company <https://developers.inter
7575

7676
# tag request
7777
intercom.users.find_all(tag_id='30126')
78-
78+
7979
# segment request
8080
intercom.users.find_all(segment_id='30126')
8181

@@ -89,10 +89,10 @@ Intercom documentation: `View a User <https://developers.intercom.io/reference#v
8989

9090
# ID request
9191
intercom.users.find(id='1')
92-
92+
9393
# User ID request
9494
intercom.users.find(user_id='1')
95-
95+
9696
# Email request
9797
intercom.users.find(email='bob@example.com')
9898

@@ -106,11 +106,11 @@ Intercom documentation: `Deleting a User <https://developers.intercom.io/referen
106106
# ID Delete Request
107107
user = intercom.users.find(id='1')
108108
deleted_user = intercom.users.delete(user)
109-
109+
110110
# User ID Delete Request
111111
user = intercom.users.find(user_id='1')
112112
deleted_user = intercom.users.delete(user)
113-
113+
114114
# Email Delete Request
115115
user = intercom.users.find(email='bob@example.com')
116116
deleted_user = intercom.users.delete(user)
@@ -196,10 +196,10 @@ Intercom documentation: `Create and Update Tags <https://developers.intercom.io/
196196

197197
# Create Request
198198
tag = intercom.tags.create(name='Independentt')
199-
199+
200200
# Update Request
201-
intercom.tags.tag_users(name='Independent', id=tag.id)
202-
201+
intercom.tags.tag(name='Independent', id=tag.id)
202+
203203

204204
Tag or Untag Users & Companies
205205
++++++++++++++++++++++++++++++
@@ -209,19 +209,10 @@ Intercom documentation: `Tag or Untag Users & Companies <https://developers.inte
209209
::
210210

211211
# Multi-User Tag Request
212-
intercom.tags.tag_users('Independent', ["42ea2f1b93891f6a99000427", "42ea2f1b93891f6a99000428"])
213-
214-
# Untag Request
215-
intercom.tags.untag_users('blue', ["42ea2f1b93891f6a99000427"])
216-
217-
Delete a Tag
218-
++++++++++++
212+
intercom.tags.tag(name='Independent', users=["42ea2f1b93891f6a99000427", "42ea2f1b93891f6a99000428"])
219213

220-
Intercom documentation: `Delete a Tag <https://developers.intercom.io/reference#delete-a-tag>`_.
221-
222-
::
223-
224-
intercom.tags.delete()
214+
# Untag Request
215+
intercom.tags.untag(name='blue', users=["42ea2f1b93891f6a99000427"])
225216

226217

227218
List Tags for an App
@@ -279,7 +270,7 @@ Intercom documentation: `List Notes for a User <https://developers.intercom.io/r
279270
# User ID Request
280271
for note in intercom.notes.find_all(user_id='123'):
281272
...
282-
273+
283274
# User Email Request
284275
for note in intercom.notes.find_all(email='foo@bar.com'):
285276
...
@@ -318,10 +309,10 @@ Intercom documentation: `Getting Counts <https://developers.intercom.io/referenc
318309

319310
# Conversation Admin Count
320311
intercom.counts.for_type(type='conversation', count='admin')
321-
312+
322313
# User Tag Count
323314
intercom.counts.for_type(type='user', count='tag')
324-
315+
325316
# User Segment Count
326317
intercom.counts.for_type(type='user', count='segment')
327318

@@ -330,7 +321,7 @@ Intercom documentation: `Getting Counts <https://developers.intercom.io/referenc
330321

331322
# Company User Count
332323
intercom.counts.for_type(type='company', count='user')
333-
324+
334325
# Global App Counts
335326
intercom.counts.for_type()
336327

0 commit comments

Comments
 (0)