Skip to main content

intercom-python

intercom-python is an API wrapper for intercom, written in Python.
This library uses Oauth2 for authentication.

Installing

pip install intercom-python-2

Usage

# if you have an access token:
from intercom.client import Client
client = Client(access_token=access_token)
# if you are using Oauth2 to get an access_token:
from intercom.client import Client
client = Client(client_id=client_id, client_secret=client_secret)

To obtain and set an access token:

  1. Get authorization URL
url = client.authorization_url(redirect_uri)
  1. Get access token using code
response = client.get_access_token(code)
  1. Set access token
client.set_token(access_token)

Check more information about Intercom Oauth: https://developers.intercom.com/building-apps/docs/setting-up-oauth

Get current user

me = client.get_current_user()

List all admins

admins = client.list_all_admins()

List data attributes

# model options are: contact, company, conversation
data_atts = client.list_data_attributes(model, include_archived=False)

List tags

tags = client.list_tags()

Contacts

- List all contacts

contacts = client.list_all_contacts()

- Filter contacts

# field options: https://developers.intercom.com/intercom-api-reference/reference/searchcontacts
contacts = client.filter_contacts(field, operator, value)
# operator options: =, !=, IN, NIN, <, >, ~, !~, ^, $

- Create contact

# role options are: 'user' and 'lead'
# signed_up_at and last_seen_at use epoch time stamp. For example: 1685986703 equals Monday, 5 June 2023 17:38:23
# custom_attributes dict structure:
#     {"field_name": "field_value", "field_name": "field_value", ...}
contact = client.create_contact(
    role: str, 
    email: str, 
    external_id: str = None,
    phone: str = None,
    name: str = None,
    avatar: str = None,
    signed_up_at: int = None,
    last_seen_at: int = None,
    owner_id: int = None,
    unsubscribed: bool = None,
    custom_attributes: dict = None
)

- Add tag to contact

response = client.add_tag_to_contact(contact_id, tag_id)

- Create a note

text = "this is a note"
response = client.create_note(contact_id, text)

Metadata

Release files for intercom-python-2 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for intercom-python-2 0.1.2
File Size Uploaded
intercom_python_2-0.1.2.tar.gz 3.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for intercom-python-2 0.1.2
File Interpreter ABI Platform
intercom_python_2-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 8.8 kB

Release files / intercom_python_2-0.1.2.tar.gz

Download URL intercom_python_2-0.1.2.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
49a8bc957d85f6d42b193d40459afc6c2fa5fe497cc052227aa855c3e49074ba
BLAKE2b-256 checksum
How to use checksums
0f2d54a1cd21cd9d42ea576304783b088e39b14932fac24d98eb458bb44b3577
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.6

Release files / intercom_python_2-0.1.2-py3-none-any.whl

Download URL intercom_python_2-0.1.2-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a9cdf62713f4172f9e70c4dd0e62c394f5f176ba0db4433228d9eef718d8bcf1
BLAKE2b-256 checksum
How to use checksums
0ad30ecf25573efe3ef6b9c0c0dbb72d520748f01f9c2cde0a232f13dfab9d95
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.6

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page