Python client for the HelpScout Mailbox API v2
Project description
helpscout-mailbox
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 filteringget_conversation(conversation_id)- Fetch conversation detailssnooze_conversation(conversation_id, snoozed_until)- Snooze conversationadd_tags(conversation_id, tags)- Add tags (preserves existing)
Threads
conversation_threads(conversation_id)- List threads (cached)conversation_body(conversation_id)- Concatenated HTML bodyadd_note(conversation_id, text)- Create note threadupdate_thread_text(conversation_id, thread_id, text)- Update thread bodycreate_reply(conversation_id, customer_id, text, draft)- Create replysend_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:
- Click "Create My App"
- Give it a name (e.g., "Invoice Processor")
- Copy the App ID and App Secret
- 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-Afterheader) - 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
- Discussions: GitHub Discussions — for questions and support
- HelpScout API Docs: developer.helpscout.com
Project details
Release history Release notifications | RSS feed
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 helpscout_mailbox-1.0.3.tar.gz.
File metadata
- Download URL: helpscout_mailbox-1.0.3.tar.gz
- Upload date:
- Size: 12.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
08d3fe2b5c863bc629571a66e7eec8c4473ab30d4f876145ac36ba1e6e98723c
|
|
| MD5 |
609976f645135005d91a24f3a463c7d9
|
|
| BLAKE2b-256 |
2bb09effa2eed0be43ba03b318f70e2f18f386af87ce119edc7d9ae08d296e68
|
Provenance
The following attestation bundles were made for helpscout_mailbox-1.0.3.tar.gz:
Publisher:
publish.yml on Connectify/helpscout-mailbox
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
helpscout_mailbox-1.0.3.tar.gz -
Subject digest:
08d3fe2b5c863bc629571a66e7eec8c4473ab30d4f876145ac36ba1e6e98723c - Sigstore transparency entry: 1872710813
- Sigstore integration time:
-
Permalink:
Connectify/helpscout-mailbox@1728c099aa8ce8b5533168c4e571b16839d35f6e -
Branch / Tag:
refs/tags/v1.0.3 - Owner: https://github.com/Connectify
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1728c099aa8ce8b5533168c4e571b16839d35f6e -
Trigger Event:
release
-
Statement type:
File details
Details for the file helpscout_mailbox-1.0.3-py3-none-any.whl.
File metadata
- Download URL: helpscout_mailbox-1.0.3-py3-none-any.whl
- Upload date:
- Size: 9.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc034c7e00c96934722cba864f182213f1bd2eec718b8edef90d2e3ab1b401bb
|
|
| MD5 |
f2f5a27dcc505ecccb37a1d53696af9f
|
|
| BLAKE2b-256 |
216dfef29e9c2565e6ccec8e0a481223a5bd401940b2d59b4b9e6c2105aecdca
|
Provenance
The following attestation bundles were made for helpscout_mailbox-1.0.3-py3-none-any.whl:
Publisher:
publish.yml on Connectify/helpscout-mailbox
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
helpscout_mailbox-1.0.3-py3-none-any.whl -
Subject digest:
fc034c7e00c96934722cba864f182213f1bd2eec718b8edef90d2e3ab1b401bb - Sigstore transparency entry: 1872710909
- Sigstore integration time:
-
Permalink:
Connectify/helpscout-mailbox@1728c099aa8ce8b5533168c4e571b16839d35f6e -
Branch / Tag:
refs/tags/v1.0.3 - Owner: https://github.com/Connectify
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1728c099aa8ce8b5533168c4e571b16839d35f6e -
Trigger Event:
release
-
Statement type: