Skip to main content

Python client for Clappia API integration

Project description

Clappia Tools

LangChain integration for Clappia API

PyPI - Python Version License: MIT


Overview

Clappia Tools is a Python package that provides a unified client and a set of tools for seamless integration with the Clappia API. It enables developers to automate workflows, manage submissions, and interact with Clappia apps programmatically. The package is designed for use in automation, data integration, and agent-based systems (e.g., LangChain agents).


Features

  • Unified API Client: One client for all Clappia API operations.
  • Submission Management: Create, edit, update owners, and change status of submissions.
  • App Definition Retrieval: Fetch complete app structure and metadata.
  • Input Validation: Built-in validation for IDs, emails, and status objects.
  • Extensible Tools: Modular functions for each operation, easily integrated into agents or scripts.
  • Comprehensive Testing: Includes unit and integration tests.

Installation

pip install clappia-tools

Or, for development:

git clone https://github.com/clappia-dev/clappia-tools.git
cd clappia-tools
pip install -e .[dev]

Configuration

You must provide your Clappia API credentials and workspace information directly when initializing the ClappiaClient:

  • api_key: Your Clappia API key
  • base_url: The base URL for the Clappia API (e.g., https://api.clappia.com)
  • workplace_id: Your Clappia workplace ID

Example:

from clappia_tools import ClappiaClient

client = ClappiaClient(
    api_key="your-api-key",
    base_url="https://api.clappia.com",
    workplace_id="your-workplace-id"
)

Usage

Basic Client Usage

from clappia_tools import ClappiaClient

client = ClappiaClient(
    api_key="your-api-key",
    base_url="https://api.clappia.com",
    workplace_id="your-workplace-id"
)

# Create a submission
result = client.create_submission(
    app_id="MFX093412",
    data={"employee_name": "John Doe", "department": "Engineering"},
    email="user@example.com"
)
print(result)

# Edit a submission
result = client.edit_submission(
    app_id="MFX093412",
    submission_id="HGO51464561",
    data={"department": "Marketing"},
    email="user@example.com"
)
print(result)

# Get app definition
result = client.get_app_definition(app_id="MFX093412")
print(result)

Tool Functions

You can also use the modular tool functions directly:

from clappia_tools._tools import (
    create_clappia_submission,
    edit_clappia_submission,
    get_app_definition,
    update_clappia_submission_owners,
    update_clappia_submission_status,
)

# Create a submission
data = {"employee_name": "Jane Doe", "department": "HR"}
response = create_clappia_submission("MFX093412", data, "user@example.com")
print(response)

# Update submission owners
response = update_clappia_submission_owners(
    "MFX093412", "HGO51464561", "admin@example.com", ["user1@company.com", "user2@company.com"]
)
print(response)

# Update submission status
response = update_clappia_submission_status(
    "MFX093412", "HGO51464561", "admin@example.com", {"statusName": "Approved", "comments": "Reviewed."}
)
print(response)

Available Tools

  • create_clappia_submission(app_id, data, email)
  • edit_clappia_submission(app_id, submission_id, data, email)
  • get_app_definition(app_id, language="en", strip_html=True, include_tags=True)
  • update_clappia_submission_owners(app_id, submission_id, requesting_user_email_address, email_ids)
  • update_clappia_submission_status(app_id, submission_id, requesting_user_email_address, status)

See docstrings in each tool for detailed argument and return value descriptions.


Input Validation

  • App ID: Must be uppercase letters and numbers (e.g., MFX093412).
  • Submission ID: Must be uppercase letters and numbers (e.g., HGO51464561).
  • Email: Must be a valid email address.
  • Status: Must be a dictionary with a non-empty statusName or name field.

Invalid inputs will return descriptive error messages.


Testing

Run all tests (unit and integration):

pytest

Contributing

  1. Fork the repository and create your branch.
  2. Write clear, well-documented code and tests.
  3. Run pytest and ensure all tests pass.
  4. Submit a pull request with a clear description of your changes.

License

This project is licensed under the MIT License. See LICENSE for details.

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

clappia_tools-0.1.5.tar.gz (25.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

clappia_tools-0.1.5-py3-none-any.whl (29.7 kB view details)

Uploaded Python 3

File details

Details for the file clappia_tools-0.1.5.tar.gz.

File metadata

  • Download URL: clappia_tools-0.1.5.tar.gz
  • Upload date:
  • Size: 25.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.11

File hashes

Hashes for clappia_tools-0.1.5.tar.gz
Algorithm Hash digest
SHA256 2ae1892629bab67f3aa5bad7a0912c5981e3a1ffe732a8449b44b4b0b317479e
MD5 2e09bb8732aa5e2b88204ea744497bee
BLAKE2b-256 c9aead0563fa64310c8adecb8f2684b8e71b4862d3384e97e1437c15678251f8

See more details on using hashes here.

File details

Details for the file clappia_tools-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for clappia_tools-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 2195ba9bf30a6e4fe7688b59310a625648a4d649dbef357afc81b52aa9942cb7
MD5 994e6c6eeb0b5f265904219d266b2f8f
BLAKE2b-256 99d13e10bfc23198c4990ed51e569e949df5a2bc58bc5cd015d350213c2177ea

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page