Skip to main content

A Simple Drift API Wrapper.

Project description

<p align="center">
<img src="img/drift_python.png" width="300"/>
</p>

# Drift Python
A [Drift API](https://devdocs.drift.com) wrapper written in Python.


## Getting Started
To get started run `pip install drift-python`

```python
from drift import Drift
drift = Drift("YOUR ACCESS TOKEN")
```

## Contacts
Read the docs here: [Contacts API](https://devdocs.drift.com/docs/contact-model).

**Available Methods**

- `drift.contacts.get()`
- contact_id (required)
- email (optional)
- limit (optional)
-
- `drift.contacts.create()`
- **attributes (required)

Example:
`drift.contacts.create(email='johndoe@drift.com')`

- `drift.contacts.update()`
- contact_id (required)
- **attributes (required)

- `drift.contacts.delete()`
- contact_id (required)

- `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()`
- contact_id (required)

## Conversations
Read the docs here [Conversations API](https://devdocs.drift.com/docs/conversation-overview)

**Available Methods**

- `drift.conversations.get()`
- conversation_id (required)

- `drift.conversations.list()`
- limit (optional) - defaults to `50`
- next_ (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()`
- doc_id (required)

- `drift.conversations.get_metrics()`
- query (required)

Example:
```
drift.conversations.get_metrics(
{
"metrics": [
{
"type": "AVG",
"property": "numBotMessages"
}
],
"filters": [
{
"property": "createdAt",
"operation": "BETWEEN",
"values": ["2018-01-01", "2018-07-31"]
}
]
}
)

```


## Contributors
- Lemuel Boyce [rhymiz](https://github.com/rhymiz)
- Chris Buonocore [cbonoz](https://github.com/cbonoz)


## Support / Feedback / Bugs
For support and feedback, you can find us on [Slack](https://join.slack.com/t/devdrift/shared_invite/enQtMzg4MTI3NDk5NDQ0LWUwMWYzZTkyMmQ1YjdkNjkwZDg2Mzk2YjAyMDg4MWViYmIzZjVhZTczNDQwMDVjOGRjZGU5OTkxMWQ0ZGU0Mjg)!

If you've found a bug, feel free to open up a PR with a fix or submit an issue.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

drift-python-1.0.3.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

drift_python-1.0.3-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file drift-python-1.0.3.tar.gz.

File metadata

  • Download URL: drift-python-1.0.3.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/38.4.0 requests-toolbelt/0.8.0 tqdm/4.19.1 CPython/3.6.4

File hashes

Hashes for drift-python-1.0.3.tar.gz
Algorithm Hash digest
SHA256 0764a8d766c7b8c7c8ee3b9f5b6376803f9a68f531e609699ffca930f2e01300
MD5 883570496c5745d692a6cd735373ea9d
BLAKE2b-256 2c6ceecaecc42591255053f97b956eb94af7b600393248a96c597f85fe9dc23f

See more details on using hashes here.

File details

Details for the file drift_python-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: drift_python-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/38.4.0 requests-toolbelt/0.8.0 tqdm/4.19.1 CPython/3.6.4

File hashes

Hashes for drift_python-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 62ddd1b7941eac79cddcb6bbc39218e682b76ea2507f2d1cfb77e00e52f6f584
MD5 ee98787d13ea78e693a855431208899c
BLAKE2b-256 fb0e2c3e733bc5d97881ab1df2abc12a226640a2a36cd096ad02469c6ce506bc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page