Skip to main content

A Simple Drift API Wrapper.

Project description

Open Source Love PyPI version

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()

    • **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

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"]
            }
          ]
        }
    )
    
    

Users

Read the docs here Users API

Available Methods

  • drift.users.get()

    • user_id (required)
  • drift.users.list()

  • drift.users.update()

    • user_id (required)
    • **attributes (required)

    Example: drift.users.update(243266, phone='555-555-5555')

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!

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.1.1.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

drift_python-1.1.1-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: drift-python-1.1.1.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.20.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.1

File hashes

Hashes for drift-python-1.1.1.tar.gz
Algorithm Hash digest
SHA256 b1d8a510c22172ef8f119a593e184848d99a39dca33a7b7fa6a35edc05e3934b
MD5 c61e7a899716215e1253643274bca07b
BLAKE2b-256 f0fa0489a166c695e678d82d8c76ffda4534921384d9fd392914e7ff7c0dbf64

See more details on using hashes here.

File details

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

File metadata

  • Download URL: drift_python-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.20.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.1

File hashes

Hashes for drift_python-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cef37a905ad2d8925aeb3acaba00166aab6ac652494d8268c5d8104ebccbb35a
MD5 691bf44c3bf1bc0a8e7731f44c1d43a1
BLAKE2b-256 455f900f78593fa5fc9d953b52e2a479d2b99e33fd987bd43bfeabf086f156f5

See more details on using hashes here.

Supported by

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