Skip to main content

tai42-tools-whatsapp

License: Apache 2.0

WhatsApp provisioning tools for the TAI ecosystem — manifest-loaded Meta Graph tools that register a message template, list the business account's message templates, delete a template by name, and subscribe the app to a WhatsApp Business Account's webhooks.

All Graph traffic is direct REST through tai42-kit's curl client (no vendor SDK); the Graph host and pinned API version ride the settings below. The package registers its tools through the tai42_app handle from tai42_contract.app and never imports the skeleton.

The TAI ecosystem

TAI is an open-source runtime for MCP tools, agents, and workflows. A tool is a callable the host loads from a plugin manifest; this package supplies the WhatsApp provisioning tools. The ecosystem is open-ended, so this repo is these tools' own full doc home, and the documentation site covers the platform-level story:

Install

Requires Python 3.13+. Install from PyPI into the environment that runs the server:

uv add tai42-tools-whatsapp

Or from source — clone this repo and add it as an editable dependency; the tai42-* dependencies resolve in-tree from the workspace.

git clone https://github.com/tai42ai/tai42   # next to your app checkout
cd /path/to/your/app
uv add --editable ../tai42/plugins/tools-whatsapp

Catalog

Tool Description
register_whatsapp_template Registers a message template on the account and returns Graph's id and review status.
list_whatsapp_templates Lists every message template on the account, following Graph's paging cursors to exhaustion.
delete_whatsapp_template Deletes a message template by name (percent-encoded into the query) and returns Graph's response.
subscribe_whatsapp_app Subscribes the app to the account's webhooks, optionally overriding the callback URI and verify token.

Registering templates

register_whatsapp_template takes name, language, category, and a Graph-shaped components list (all required and non-empty). components is passed through unchanged — Graph validates its shape and rejects a malformed one with its own error, which propagates. The tool returns Graph's response (the new template's id and review status).

list_whatsapp_templates returns the concatenated data across every page, following Graph's paging.next cursor until Graph stops sending one, so a long template catalog is never silently truncated. delete_whatsapp_template takes a single name, percent-encoded into the delete query.

Subscribing webhooks

subscribe_whatsapp_app subscribes the app to the account's webhooks. With both callback_uri and verify_token supplied it overrides the app's configured webhook with Meta's override_callback_uri + verify_token pair; with neither it subscribes to the app's configured webhook. Supplying exactly one of the two raises.

Configuration

Setting Env var Default Purpose
Access token CHANNEL_WHATSAPP_ACCESS_TOKEN Graph API bearer token. Required.
Business account CHANNEL_WHATSAPP_WABA_ID WhatsApp Business Account id the endpoints hang under. Required.
API base CHANNEL_WHATSAPP_API_BASE_URL https://graph.facebook.com/v23.0 Graph API origin with a pinned version.
Request timeout CHANNEL_WHATSAPP_HTTP_TIMEOUT_SECONDS 30 Per-request HTTP timeout.

The token and WABA id share the CHANNEL_WHATSAPP_ env group with the rest of the WhatsApp deployment. Secrets live only in the environment; the access token is held as a secret and never appears in a log or a raised error. A missing or empty required credential raises loudly (fails closed), and every non-2xx from Graph raises with Graph's status and body — never a silent default.

Development

uv venv --python 3.13
uv pip install --no-sources --extra dev --editable .
uv run --no-sync pytest --cov --cov-report=term-missing
uv run --no-sync ruff check .
uv run --no-sync ruff format --check .
uv run --no-sync pyright

License

Apache-2.0. See LICENSE and NOTICE.

Download files

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

Source Distribution

tai42_tools_whatsapp-1.0.7.tar.gz (16.1 kB view details)

Uploaded Source

Built Distribution

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

tai42_tools_whatsapp-1.0.7-py3-none-any.whl (18.7 kB view details)

Uploaded Python 3

File details

Details for the file tai42_tools_whatsapp-1.0.7.tar.gz.

File metadata

  • Download URL: tai42_tools_whatsapp-1.0.7.tar.gz
  • Upload date:
  • Size: 16.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for tai42_tools_whatsapp-1.0.7.tar.gz
Algorithm Hash digest
SHA256 6d6b7bcf81eddb45789ea2026b4b0e63abb39aaab725fdfb808a2727c9b4d7cd
MD5 fa4f9c49c95ea7a4a3a51bc7590cb590
BLAKE2b-256 fdec94d87c6c2fbe055dc2fdabf68703a19c2a852009bb589c71231048d9b3e8

See more details on using hashes here.

File details

Details for the file tai42_tools_whatsapp-1.0.7-py3-none-any.whl.

File metadata

File hashes

Hashes for tai42_tools_whatsapp-1.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 227a9cc09c23eaa73e26b8f3274b8462f78b157d5c18c0a684771d4928659a8b
MD5 1bf58398ca3b8bb4b3e991044063c095
BLAKE2b-256 33381e9e7b817840017e5c7d1ea9ea919813a2912d23feac42e6f09822b0c811

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.7 This release

2 files

1.0.6

2 files

1.0.5

2 files

1.0.4

2 files

1.0.3

2 files

1.0.2

2 files

1.0.1

2 files

1.0.0

2 files

0.2.0

2 files

0.1.0

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