Skip to main content

Workhub API Client

The Workhub API Client is a Python package designed to simplify interactions with the Workhub API. It supports user authentication, company information retrieval, conversation management, message handling, and direct integration with GPT-4 for processing messages.

Features

  • User authentication
  • Fetch company information
  • Manage conversations
  • Send messages with optional GPT-4 processing
  • Stream bot responses directly after sending a message

Installation

To install the Workhub API Client, use pip:

pip install workhub-client

Quick Start

Initialize the Client

First, create an instance of the WorkhubClient:

from workhub_client import WorkhubClient

client = WorkhubClient()

Authenticate

Log in using your Workhub credentials:

client.login('your_email@example.com', 'your_password')

Fetch Company Information

Retrieve and automatically set your active company UUID:

company_info = client.get_company_info()
print(company_info)

Send a Message

Send a message to a specific conversation. You can specify GPT-4 processing by setting document_type='GPT4'.

conversation_uuid = 'your_conversation_uuid_here'
response = client.send_user_message(
    conversation_uuid,
    "What's the weather like today?",
    document_type='GPT4'
)
print(response)

Stream Bot Responses

Send a user message and directly stream the bot's response:

client.stream_bot_message(
    conversation_uuid="your_conversation_uuid",
    content="when was uark founded?",
    document_type="GPT4"
)

This method sends a message and immediately starts listening for and printing the streamed response from the bot.

Workhub API Client Example

This section provides a simple Python program example that uses the Workhub API Client to authenticate, fetch company information, send a message with GPT-4 processing, and stream the bot's response.

Example Program

from workhub_client import WorkHubClient

def main():
    # Initialize the Workhub API client
    client = WorkHubClient()

    # Login with your Workhub credentials
    print("Logging in...")
    client.login('your_email@example.com', 'your_password')

    # Fetch and display company information
    print("Fetching company information...")
    company_info = client.get_company_info()
    print(f"Company Info: {company_info}")

    # Specify the UUID of the conversation you want to interact with
    conversation_uuid = 'your_conversation_uuid_here'

    # Send a message using GPT-4 processing and display the response
    print("Sending a message with GPT-4 processing...")
    message_response = client.send_user_message(
        conversation_uuid,
        "What's the weather like today?",
        document_type='GPT4'
    )
    print(f"Message Response: {message_response}")

    # Stream bot's response directly after sending a message
    print("Streaming bot's response...")
    client.stream_bot_message(
        conversation_uuid=conversation_uuid,
        content="when was uark founded?",
        document_type="GPT4"
    )

if __name__ == "__main__":
    main()

Running the Example

  1. Replace 'your_email@example.com', 'your_password', and 'your_conversation_uuid_here' with your actual Workhub credentials and the UUID of the conversation you want to send a message to.
  2. Save the program to a file, for example, workhub_example.py.
  3. Run the program using Python:
python workhub_example.py

This example demonstrates the core functionalities of the Workhub API Client, making it easy for users to understand how to use the package in their applications. Remember, when sharing or using your credentials and sensitive information, always ensure they are secured and not hardcoded in production scripts.

Contributing

Contributions to the Workhub API Client are welcome. Please feel free to submit pull requests or report issues to improve the project.

License

This project is released under the MIT License.

Metadata

Release files for workhub-client 1.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for workhub-client 1.0.7
File Size Uploaded
workhub_client-1.0.7.tar.gz 5.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for workhub-client 1.0.7
File Interpreter ABI Platform
workhub_client-1.0.7-py3-none-any.whl Python 3 none any Details

Total release size: 10.6 kB

Release files / workhub_client-1.0.7.tar.gz

Download URL workhub_client-1.0.7.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
1193729a0eb933669000f4f97c9ae9ef836709c6298b125fe12b39bb850cf1ab
BLAKE2b-256 checksum
How to use checksums
3f7271be45120e6931721a62192c6deaea072809a2bc6d4f42a4c56894cae279
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.1

Release files / workhub_client-1.0.7-py3-none-any.whl

Download URL workhub_client-1.0.7-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b5836873f12fefdce18620ac44474e29201913881d601a53b80d060fe0a97d91
BLAKE2b-256 checksum
How to use checksums
5794a6c367d6676b4e123e07c8f188a5001d110f6f85f6a5d0b9d260ad8be747
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.1

Release history Release notifications | RSS feed

This release

1.0.7 This release

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page