Skip to main content

peepstick

Drop this into a Python app to get ticket routing that goes straight to your team's Slack channel — configured entirely from the PeepsTick dashboard.

This package never talks to Slack. It only ever calls your PeepsTick project's API (/api/form-schema, /api/tickets). PeepsTick owns the Slack webhook and does the actual posting server-side.

Install

# FastAPI apps
pip install "peepstick[fastapi]"

# Django apps
pip install "peepstick[django]"

FastAPI setup

from fastapi import FastAPI
from peepstick.fastapi import create_ticket_router

app = FastAPI()
app.include_router(
    create_ticket_router(
        api_key="tk_...",             # from your project's page in the PeepsTick dashboard
        base_url="https://peepstick.yourcompany.com",
    ),
    prefix="/peepstick",
)

This gives your app two routes your frontend can call — the API key never reaches the browser:

  • GET /peepstick/form-schema — the live fields configured for your project
  • POST /peepstick/tickets — submits a ticket, validated and routed to Slack server-side. Accepts either:
    • a JSON body: {"fields": {...}}
    • a multipart/form-data body (send each field as its own form value, plus one or more files under any file-type field's id) — use this when the project's form schema includes an attachment field. PeepsTick enforces the limits (10MB per file, 20MB total) and rejects anything over.

Add or rename fields in the PeepsTick dashboard and /peepstick/form-schema updates automatically — no code changes or redeploys needed.

Django setup

  1. In settings.py, add the app and your project's credentials (find the API key on your project's page in the PeepsTick dashboard):

    INSTALLED_APPS = [
        ...,
        "peepstick.django",
    ]
    
    PEEPSTICK_API_KEY = "tk_..."
    PEEPSTICK_BASE_URL = "https://peepstick.yourcompany.com"
    
  2. In your project's urls.py:

    from django.urls import include, path
    
    urlpatterns = [
        ...,
        path("tickets/", include("peepstick.django.urls")),
    ]
    
  3. Visit /tickets/. The form renders whatever fields are configured for your project in the PeepsTick dashboard — add or rename fields there and the form updates automatically, no code changes needed. A file-type field renders as <input type="file" multiple>, so visitors can attach more than one file per submission.

Using the client directly

If you'd rather build your own view or call PeepsTick from a script:

from peepstick import PeepsTickClient

client = PeepsTickClient(api_key="tk_...", base_url="https://peepstick.yourcompany.com")

fields = client.get_form_schema()
ticket = client.submit_ticket({"title": "Login broken", "priority": "High"})

# With file attachments -- `files` maps a field id to a LIST of
# (filename, content_bytes, content_type) tuples, any number per field:
with open("screenshot.png", "rb") as f:
    ticket = client.submit_ticket(
        {"title": "Login broken", "priority": "High"},
        files={"attachment": [("screenshot.png", f.read(), "image/png")]},
    )

Both methods raise peepstick.PeepsTickError on failure (network issues, invalid API key, missing required fields, etc).

Two-way tickets (0.4.0+)

With the project's secret key (sk_..., generated on the PeepsTick project page — keep it on your server), your backend can show users their tickets, let them correct them, and follow up:

from peepstick import PeepsTickClient, PeepsTickError, verify_webhook

client = PeepsTickClient(api_key=settings.PEEPSTICK_SECRET_KEY, base_url=settings.PEEPSTICK_BASE_URL)
reporter = {"id": str(user.id), "email": user.email, "name": user.get_full_name(),
            "orgId": str(department.id), "orgName": department.name}

client.submit_ticket(fields, files=files, reporter=reporter,
                     labels=["Current", "Expected"], context={"page": "/intake", "role": "clerk"})
client.list_tickets(reporter, scope="team", status=["submitted", "in_progress"], q="intake")
client.get_ticket(reporter, 42)                      # ticket, comments, history, permissions
client.update_ticket(reporter, 42, fields={"title": "Intake page won't save"})  # until triaged
client.add_comment(reporter, 42, "Still happening", files=[("now.png", data, "image/png")])
client.transition(reporter, 42, "reopen", comment="Broken again on Firefox")
client.find_similar(reporter, "intake page")
content, content_type, filename = client.get_attachment(reporter, 42, attachment_id)

Errors raise PeepsTickError with .status_code (404 not visible to this reporter, 409 edit after work started, ...). verify_webhook(raw_body, signature, timestamp, secret) checks PeepsTick webhook deliveries.

Metadata

Release files for peepstick 0.4.0

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

Source distribution (sdist)

Source distribution for peepstick 0.4.0
File Size Uploaded Provenance Actions
peepstick-0.4.0.tar.gz 12.0 kB Without provenance Details for peepstick-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for peepstick 0.4.0
File Interpreter ABI Platform Actions
peepstick-0.4.0-py3-none-any.whl Python 3 none any Details for peepstick-0.4.0-py3-none-any.whl

Total release size: 23.8 kB

Release files / peepstick-0.4.0.tar.gz

Download URL peepstick-0.4.0.tar.gz
Size 12.0 kB
Tags Source
SHA-256 checksum
How to use checksums
8bbcbb4c5299746f9d6b63b0b520b9c3da9c04c05f96c8ef0536ebf7e24eb5b7
BLAKE2b-256 checksum
How to use checksums
3e1985c2fe48d25d514dc6c5ed70114947e77077271b0d8fa2d5d20eed97bee0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / peepstick-0.4.0-py3-none-any.whl

Download URL peepstick-0.4.0-py3-none-any.whl
Size 11.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e3f798825009fbc2b5e049b1e84237713b9296a9a98b975740d44aafdd36df5f
BLAKE2b-256 checksum
How to use checksums
22a0c608312bf4e7f92a1eaf027005d02acbb2c60bf50962af0730deeb15738f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Security for peepstick 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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