Crisp API Python.
Project description
Unofficial Crisp API Python wrapper. Use Python code to authenticate, send messages, get conversations, and access your proxy account.
- 😘 Official Repository: python-crisp-api
- 📝 Implements: Crisp Platform - API ~ v1 at reference revision: 12/31/2017
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8504635389ffac37d850680a2c492c42167de59ebfae05fb6accea005980cd35 |
|
MD5 | 08ade4c6ded9aba889d9280a965755a2 |
|
BLAKE2b-256 | b09ab479a3430bbc3d29f46be9443a1b63ddcefc2d1f7ff65d93b9eae5d2f7a0 |
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 68d7360067dc0983f34635e555cbd7f9dbc801fa92c95893374bba8ed1727afe |
|
MD5 | d2b6a7f501b350a06706733064bc200a |
|
BLAKE2b-256 | f01ab566ac250c40eda5c80b17d27ce5f2f53c4ffacdd8dbe261daa1b85c6a7e |