Skip to main content

helpscout-mailbox

PyPI Python Versions License Tests

A Python client for the HelpScout Mailbox API v2.

Disclaimer: This package is unofficial and not associated with or endorsed by HelpScout. It is provided "as is" without warranty of any kind. Please use GitHub Discussions for support — there is no guarantee that Connectify staff will respond.

Features

  • OAuth2 client-credentials authentication with automatic token refresh
  • Retry logic for rate limiting (429), server errors (5xx), and transient failures
  • Conversation management: search, read, snooze, tag
  • Thread operations: notes, replies, drafts, attachments
  • Clean API with type hints and comprehensive docstrings

Installation

pip install helpscout-mailbox

Quick Start

import os
from datetime import date, datetime, timedelta, timezone
from helpscout_mailbox import HelpScoutClient

# Set credentials (create app at HelpScout → Your Profile → My Apps)
os.environ["HELPSCOUT_APP_ID"] = "your-app-id"
os.environ["HELPSCOUT_APP_SECRET"] = "your-app-secret"

# Initialize client (fetches OAuth2 token automatically)
client = HelpScoutClient()

# Search conversations
for conv in client.search_conversations('subject:"Invoice"', since=date(2026, 6, 1)):
    print(f"#{conv['number']}: {conv['subject']}")

# Get conversation details
conversation = client.get_conversation(12345)
print(conversation["subject"])

# Add a note
client.add_note(12345, "Processed invoice #INV-001")

# Snooze until tomorrow
tomorrow = datetime.now(timezone.utc) + timedelta(days=1)
client.snooze_conversation(12345, tomorrow)

# Add tags
client.add_tags(12345, ["billing", "processed"])

API Coverage

Conversations

  • search_conversations(query, since) - Search with client-side date filtering
  • get_conversation(conversation_id) - Fetch conversation details
  • snooze_conversation(conversation_id, snoozed_until) - Snooze conversation
  • add_tags(conversation_id, tags) - Add tags (preserves existing)

Threads

  • conversation_threads(conversation_id) - List threads (cached)
  • conversation_body(conversation_id) - Concatenated HTML body
  • add_note(conversation_id, text) - Create note thread
  • update_thread_text(conversation_id, thread_id, text) - Update thread body
  • create_reply(conversation_id, customer_id, text, draft) - Create reply
  • send_draft(conversation_id, thread_id) - Send draft reply

Attachments

  • attachment_data(conversation_id, attachment_id) - Download attachment bytes

Environment Variables

Variable Required Description
HELPSCOUT_APP_ID Yes OAuth2 app ID (from My Apps)
HELPSCOUT_APP_SECRET Yes OAuth2 app secret (from My Apps)

Authentication

The client uses OAuth2 client-credentials flow. Create an app at HelpScout → Your Profile → My Apps:

  1. Click "Create My App"
  2. Give it a name (e.g., "Invoice Processor")
  3. Copy the App ID and App Secret
  4. Set them as environment variables

The client automatically:

  • Fetches access tokens on initialization
  • Refreshes tokens before expiry
  • Retries on 401 with fresh token

Error Handling

All API errors raise HelpScoutError:

from helpscout_mailbox import HelpScoutClient, HelpScoutError

try:
    client = HelpScoutClient()
    client.get_conversation(99999)
except HelpScoutError as e:
    print(f"API error: {e}")

The client automatically retries:

  • 429 rate limits (respects Retry-After header)
  • 5xx server errors (exponential backoff)
  • Transport failures (connection resets, timeouts)

Documentation

Full API documentation: https://connectify.github.io/helpscout-mailbox/

HelpScout API reference: https://developer.helpscout.com/mailbox-api/

Development

# Clone repository
git clone https://github.com/Connectify/helpscout-mailbox.git
cd helpscout-mailbox

# Install with dev dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Run linters
pre-commit run --all-files

# Build documentation
pip install -e ".[docs]"
pdoc -o docs/ helpscout_mailbox

Contributing

Patches via pull request are welcome — please file an issue first to discuss the change before submitting a PR. Issues are not for technical support; use Discussions for that. See CONTRIBUTING.md for guidelines.

License

BSD-3-Clause. See LICENSE for details.

Support

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

helpscout_mailbox-1.0.4.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

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

helpscout_mailbox-1.0.4-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file helpscout_mailbox-1.0.4.tar.gz.

File metadata

  • Download URL: helpscout_mailbox-1.0.4.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for helpscout_mailbox-1.0.4.tar.gz
Algorithm Hash digest
SHA256 203f3a06b86abe02d0cd5c26189b7849633f42d587b4db377d0695e6e225b664
MD5 1615d832f7a68b6452f2f0b83e6a7f07
BLAKE2b-256 7dbf14cddfc00ef180a9c3ac923ef647aeb271aac160a2513b62e0c7f9de8a9b

See more details on using hashes here.

Provenance

The following attestation bundles were made for helpscout_mailbox-1.0.4.tar.gz:

Publisher: publish.yml on Connectify/helpscout-mailbox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file helpscout_mailbox-1.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for helpscout_mailbox-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 df56a5ea1713009f58264129c4e05a1c54b5a958769f822da5627d7fbf21045e
MD5 d51a0af7c8ddc12814d94a37e3f6a977
BLAKE2b-256 8eb6516c0ec204e273ed66cede60e7935a3225e3a72eb3b8dfd6189b3f88bdf8

See more details on using hashes here.

Provenance

The following attestation bundles were made for helpscout_mailbox-1.0.4-py3-none-any.whl:

Publisher: publish.yml on Connectify/helpscout-mailbox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

1.0.4 This release

2 files

1.0.3

2 files

1.0.2

2 files

1.0.1

2 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