Skip to main content

Crisp API Python.

Project description

python-crisp-api

🐍 Crisp API Python Wrapper.

Github Actions


Unofficial Crisp API Python wrapper. Use Python code to authenticate, send messages, get conversations, and access your proxy account.

Usage

Install the library:

pip install python-crisp

Then, import it:

from python_crisp import Crisp

Construct a new authenticated Crisp client with your identifier and key tokens.

client = Crisp()

client.authenticate(identifier, key)

Then, your client is ready to be consumed!

Authentication

To authenticate against the API, generate your session identifier and session key once using the Crisp token generation utility. You'll get a token keypair made of 2 values.

Keep your token keypair values private, and store them safely for long-term use.

Then, add authentication parameters to your client instance right after you create it:

client = Crisp()

# Make sure to use the correct tier if you are authenticating a plugin
# eg. with a permanent token generated from Crisp Marketplace
client.set_tier("plugin")

# Authenticate to API (identifier, key)
# eg. client.authenticate("13937834-f6ce-4556-ae4f-9e0c54faf038", "eb6c3623245521d7a6c35f5b29f3fa756e893f034ed551d84518961c5ff16dec")
client.authenticate(identifier, key)

# Now, you can use authenticated API sections.

🔴 Important: Make sure to generate your token once, and use the same token keys in all your subsequent requests to the API. Do not generate too many tokens, as we may invalidate your older tokens to make room for newer tokens.

Resource Methods

Most useful available Crisp API resources are implemented. Programmatic methods names are named after their label name in the API Reference.

Thus, it is straightforward to look for them in the library while reading the API Reference.

In the following method prototypes, crisp is to be replaced with your Crisp API instance. For example, instanciate client = Crisp() and then call eg: client.website.list_conversations(website_id, 1).

When calling a method that writes data to the API (eg. send a message with: client.website.send_message_in_conversation()), you need to submit it this way:

website_id = "88972681-a00c-4b3b-a383-cab281636484"
session_id = "session_9df2a21e-f113-41d4-8ed2-bad8b49cafd1"

client.website.send_message_in_conversation(
    website_id, 
    session_id,
    {
    "type": "text",
    "content": "This message was sent from python-crisp-api! :)",
    "from": "operator",
    "origin": "chat"
    }
)

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

python-crisp-1.0.1.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

python_crisp-1.0.1-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file python-crisp-1.0.1.tar.gz.

File metadata

  • Download URL: python-crisp-1.0.1.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.6

File hashes

Hashes for python-crisp-1.0.1.tar.gz
Algorithm Hash digest
SHA256 8504635389ffac37d850680a2c492c42167de59ebfae05fb6accea005980cd35
MD5 08ade4c6ded9aba889d9280a965755a2
BLAKE2b-256 b09ab479a3430bbc3d29f46be9443a1b63ddcefc2d1f7ff65d93b9eae5d2f7a0

See more details on using hashes here.

File details

Details for the file python_crisp-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: python_crisp-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.6

File hashes

Hashes for python_crisp-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 68d7360067dc0983f34635e555cbd7f9dbc801fa92c95893374bba8ed1727afe
MD5 d2b6a7f501b350a06706733064bc200a
BLAKE2b-256 f01ab566ac250c40eda5c80b17d27ce5f2f53c4ffacdd8dbe261daa1b85c6a7e

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