Drift Python
A Drift API wrapper written in Python.
Getting Started
To get started run pip install drift-python
from drift import Drift
drift = Drift("YOUR ACCESS TOKEN")
Contacts
Read the docs here: Contacts API.
Available Methods
-
drift.contacts.get()
- contact_id (required)
- email (optional)
- limit (optional)
-
drift.contacts.create()
Example:
drift.contacts.create(email='johndoe@drift.com')
-
drift.contacts.update()
- contact_id (required)
- **attributes (required)
-
drift.contacts.delete()
-
drift.contacts.add_tags()
- contact_id (required)
- tags (required)
Example:
drift.contacts.add_tags(
conversation_id=1,
tags=[{'name': 'My Tag'}]
)
-
drift.contacts.remove_tag()
- contact_id (required)
- tag_name (required)
-
drift.contacts.remove_tags_bulk()
Conversations
Read the docs here Conversations API
Available Methods
-
drift.conversations.get()
- conversation_id (required)
-
drift.conversations.list()
- limit (optional) - defaults to
50
- page_token (optional)
-
drift.conversations.create_message()
- conversation_id (required)
- org_id (required)
- type (required)
- body (optional)
- buttons (optional)
- edited_message_id (optional)
- edit_type (optional)
Example:
drift.conversations.create_message(
conversation_id=1,
org_id=1,
type='chat'
)
-
drift.conversations.get_messages()
- conversation_id (required)
- next_ (optional)
-
drift.conversations.get_attachments()
-
drift.conversations.get_metrics()
Example:
drift.conversations.get_metrics(
{
"metrics": [
{
"type": "AVG",
"property": "numBotMessages"
}
],
"filters": [
{
"property": "createdAt",
"operation": "BETWEEN",
"values": ["2018-01-01", "2018-07-31"]
}
]
}
)
Users
Read the docs here Users API
Available Methods
Contributors
Support / Feedback / Bugs
For support and feedback, you can find us on Slack!
If you've found a bug, feel free to open up a PR with a fix or submit an issue. Let us know in the dev slack!