asterai
WhatsApp messaging via the Meta Cloud API
v0.1.0
Public
WhatsApp messaging component using the official Meta Cloud API. Supports sending and receiving text messages via webhooks.
Other components can listen for incoming messages by implementing the asterai:whatsapp/incoming-handler interface and registering themselves via the WHATSAPP_INCOMING_HANDLER_COMPONENTS environment variable.
Environment variables:
- WHATSAPP_ACCESS_TOKEN (required): Permanent access token from Meta App Dashboard.
- WHATSAPP_PHONE_NUMBER_ID (required): Phone Number ID (not WABA ID) from WhatsApp > API Setup.
- WHATSAPP_APP_SECRET (required): App Secret from Meta App Dashboard > App Settings > Basic.
- WHATSAPP_WEBHOOK_VERIFY_TOKEN (required): Token you choose when configuring the webhook in Meta Dashboard.
- WHATSAPP_INCOMING_HANDLER_COMPONENTS (optional): Comma-separated list of components to receive messages.
Interface
Exports
asterai:whatsapp/types@0.1.0
asterai:whatsapp/api@0.1.0
get-self()
send-message(content: string, to: string)
wasi:cli/run@0.2.0
run()
wasi:http/incoming-handler@0.2.0
handle(request: unknown, response-out: unknown)
Imports
asterai:host/api@1.0.0
wasi:io/poll@0.2.6
wasi:clocks/monotonic-clock@0.2.6
wasi:io/error@0.2.6
wasi:io/streams@0.2.6
wasi:http/types@0.2.4
wasi:http/outgoing-handler@0.2.4
wasi:cli/environment@0.2.6
wasi:cli/exit@0.2.6
wasi:cli/stdout@0.2.6
wasi:cli/stderr@0.2.6
wasi:random/insecure-seed@0.2.6