Official Python SDK for the Pilot Status public API.
Project description
pilot-status (Python SDK)
Official Python SDK for the Pilot Status public API.
Installation
pip install pilot-status
Quickstart
Create an API key in the dashboard and use it only on the backend.
import os
from pilot_status import PilotStatusClient
client = PilotStatusClient(
api_key=os.environ["PILOT_STATUS_API_KEY"],
)
accepted = client.messages.send(
{
"templateId": "onboarding-test",
"destinationNumber": "+5511999999999",
"variables": {"name": "John"},
}
)
message = client.messages.get(accepted["id"])
print(message["status"])
Management (projects, API keys, numbers)
These endpoints create resources within the scope (project + environment) of the current api_key.
Projects
project = client.projects.create(
{
"name": "My Project",
"description": "Optional description",
}
)
projects = client.projects.list()
API keys
key = client.api_keys.create(
{
"name": "Backend Key",
"retentionDays": 30,
}
)
keys = client.api_keys.list()
Numbers (WhatsApp)
created = client.numbers.create(
{
"name": "My WhatsApp",
"number": "+5511999999999",
}
)
status = client.numbers.get_status(created["instance"]["id"])
print(status["state"])
Opt-in check (destination authorization)
In LIVE, sending may require opt-in when using the Pilot Status WhatsApp number. You can check whether a destination is already authorized for your project:
opt_in = client.messages.check_opt_in("+5511999999999")
if not opt_in["authorized"]:
raise Exception(f"Missing opt-in: {opt_in['reason']}")
Analytics
stats = client.analytics.get_dashboard_stats(tz="America/Sao_Paulo")
print(stats["totalSent"], stats["failureRate"])
Webhooks (parse / validation)
from pilot_status import parse_customer_webhook
def handler(payload: dict):
event = parse_customer_webhook(payload)
if event["event"] == "message.failed":
print(event["data"]["errorMessage"])
Notes:
- Customer webhook payloads do not include:
projectSlug,lastMessageId,correlationId. message.receivedincludesfromMe(boolean).message.groupis delivered for inbound group messages (includesgroupName).- Supported events in the parser:
message.sent,message.delivered,message.read,message.failed,message.reply,message.received,message.group,optin.created.
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
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 pilot_status-0.1.3.tar.gz.
File metadata
- Download URL: pilot_status-0.1.3.tar.gz
- Upload date:
- Size: 15.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4db97224ebf0e808dcb195f41ee45cf81857d8abdc4144dc3999fb6e9d4c4496
|
|
| MD5 |
e40face0dc278f0e737af7f9e763173f
|
|
| BLAKE2b-256 |
ce81589fb645657d35657913ab5418d25197542c16ee9194edd966164d6c9c00
|
Provenance
The following attestation bundles were made for pilot_status-0.1.3.tar.gz:
Publisher:
publish-pypi.yml on oismaelash/pilot-status-nextjs-typescript-frontend-backend
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pilot_status-0.1.3.tar.gz -
Subject digest:
4db97224ebf0e808dcb195f41ee45cf81857d8abdc4144dc3999fb6e9d4c4496 - Sigstore transparency entry: 1228548311
- Sigstore integration time:
-
Permalink:
oismaelash/pilot-status-nextjs-typescript-frontend-backend@d499db7e7561355c654b5438224b67814e5613c1 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/oismaelash
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@d499db7e7561355c654b5438224b67814e5613c1 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file pilot_status-0.1.3-py3-none-any.whl.
File metadata
- Download URL: pilot_status-0.1.3-py3-none-any.whl
- Upload date:
- Size: 20.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ae18f15b8031bed54f7c18260f117f21757e9737c7f9d871520f6357fff72e40
|
|
| MD5 |
6068fd772258af49303958113b05d9ce
|
|
| BLAKE2b-256 |
b40c43605b8f0effd95c223affabea186b22c6d6f52c8a01d4f58485b17945fd
|
Provenance
The following attestation bundles were made for pilot_status-0.1.3-py3-none-any.whl:
Publisher:
publish-pypi.yml on oismaelash/pilot-status-nextjs-typescript-frontend-backend
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pilot_status-0.1.3-py3-none-any.whl -
Subject digest:
ae18f15b8031bed54f7c18260f117f21757e9737c7f9d871520f6357fff72e40 - Sigstore transparency entry: 1228548317
- Sigstore integration time:
-
Permalink:
oismaelash/pilot-status-nextjs-typescript-frontend-backend@d499db7e7561355c654b5438224b67814e5613c1 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/oismaelash
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@d499db7e7561355c654b5438224b67814e5613c1 -
Trigger Event:
workflow_dispatch
-
Statement type: