python-crisp 1.0.1

Creator: railscoderz

Last updated:

Add to Cart

Description:

pythoncrisp 1.0.1

python-crisp-api
🐍 Crisp API Python Wrapper.







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

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.