Python API to use WorkHub API for conversational AI.
Project description
Workhub API Client
The Workhub API Client is a versatile Python package designed for interacting with the Workhub API. It simplifies tasks such as user authentication, company information retrieval, conversation management, and message handling within the Workhub platform.
Quick Start
To get started with the Workhub API Client, you'll need to initialize it with your API credentials:
from client import WorkhubClient
client = WorkhubClient()
By default, the client is configured with the standard API endpoints. If your endpoints differ, you can specify them when initializing the client:
client = WorkhubClient(auth_base_url='https://api-admin.workhub.ai', api_base_url='https://api-teamgpt.workhub.ai')
Authenticating
Authenticate using your Workhub credentials to begin making API calls:
client.login(email='your_email@example.com', password='your_password')
Fetching Company Information
Retrieve your company's information and automatically set your active company UUID:
company_info = client.get_company_info()
print(company_info)
Managing Conversations
Fetch existing conversations, create new ones, or send messages:
-
Fetch Conversations
conversations = client.fetch_conversations() print(conversations)
-
Create a New Conversation
new_conversation = client.create_conversation(conversation_users=["user_uuid"], name="Team Meeting") print(new_conversation)
-
Send a Message
message_response = client.send_user_message(conversation_uuid="conversation_uuid", content="Hello, team!") print(message_response)
Polling for Bot Messages
You can poll for messages from a bot in a conversation, specifying a timeout as needed:
bot_message = client.poll_for_bot_message(conversation_uuid="conversation_uuid", bot_message_uuid="bot_message_uuid", user_message_uuid="user_message_uuid", timeout=30)
print(bot_message)
Error Handling
The client uses built-in exceptions for error handling. Make sure to handle these appropriately in your code to manage API call failures and other errors gracefully.
Contributing
Contributions to the Workhub API Client are welcome. Please feel free to submit pull requests or issues to improve the project.
License
This is released under MIT license.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file workhub_client-1.0.0.tar.gz.
File metadata
- Download URL: workhub_client-1.0.0.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d4df6af35bf8070450c88cf7e821a7dee0a75cae3d7856c11802f295dac9bf2
|
|
| MD5 |
400ae7b7bc28613fa2255a89fac971de
|
|
| BLAKE2b-256 |
a97d5eb47037f66b535be3ba9ff44e0296d14d6705a2fecb0f2b0f1b8062ed72
|
File details
Details for the file workhub_client-1.0.0-py3-none-any.whl.
File metadata
- Download URL: workhub_client-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
04e74d7d70a0b8d1f63ca33df8759cfccce30e19db2bc26974d7808e19c8502b
|
|
| MD5 |
10da3dfd3b06a47f13899f4c9c828f35
|
|
| BLAKE2b-256 |
e3ca415e24b51709815b499748e069ab708114f9e993eafa326025d87bccb414
|