Native whatsmeow sessions and official Meta Cloud API messaging in one Go worker; no Node or browser runtime.
Install
iii call compose::add worker=whatsapp@0.3.1Run in your project with the iii engine running. Exact versions are immutable and digest-pinned.
skill doc
- Discover the relevant registered
whatsapp::*function and inspect its schema.--cataloglists implemented Go functions; README explains unavailable operations and nullable metadata. Use the current catalog when choosing an operation. - Choose the integration requested by the user. Linked devices use whatsmeow and the selected
session_id:sessions::createcreates offline metadata;sessions::startconnects explicitly after creation or restart. Pair throughsessions::qrorsessions::pair_code, sharing pairing material only with the account owner. Go sessions need fresh storage and pairing; see the README before replacing a Rust instance. - Before operations that need follow-up, observe
whatsapp::on-eventswith filtersinput.session_id($eq) andinput.kind($inthe exact kinds),capture: [output](the target reads the event from the envelope'soutput); it takes no args. Observer metadata reaches the target separately from the event. Readsessions::getonce after the observer is ready to close races; use engine wake/event mechanisms for ongoing work. - Call outbound functions only when the session is connected and the user has authorized the recipient and action. Use string JIDs returned by the worker; preserve
@lididentities, including device suffixes. Never infer a telephone number from a LID. - Media functions accept bounded base64 bytes. Prepare the requested encoding before sending; the worker performs no transcoding or arbitrary URL fetch. Status publishing is unavailable in this Go version.
- Retain returned message IDs and event sequences. A send response is not a delivery/read receipt. A timeout can leave an unknown remote outcome: inspect events/state before retrying a mutation.
- Event delivery is best effort. Reconcile gaps with
whatsapp::events::poll;truncatedmeans some history is unavailable. Usechats::listandmessages::listfor locally retained messages without read receipts. Coverage describes retained history, not the phone's complete archive. sessions::stoppreserves credentials.sessions::logoutrequests remote unlink and clears local credentials; remote unlink is best effort.sessions::deleteremoves local state. Perform these disruptive actions only within the user's request.
Return factual operation results and per-participant failures. Treat pairing codes, QR payloads, media keys and message content as sensitive; keep them out of logs. See README for deployment, resource limits and the complete offline function catalog command.
Meta Cloud API
Use whatsapp::cloud::* without a native session. Inspect cloud::status; run
cloud::check_connection for a requested connection test. Use canonical phone
numbers with a leading + or business-scoped user IDs. Send only the authorized
text or approved template to the selected recipient. Cloud groups, account
provisioning and historical backfill are unavailable. For credentials or webhook
setup, read Official Meta Cloud API.
For ongoing Cloud webhook work, observe whatsapp::cloud::on-events in the
worker's namespace with capture: [output] (the target reads the event from
the envelope's output); it takes no args.
Read Cloud events
before writing the filters or consuming the payload. Without a filter on
input.kind, an observer receives every kind: filter input.kind on
message.received, message.status or webhook.received as requested.
Use filters on input.chat_id, input.sender_id, input.message_type,
input.status and the account IDs to limit events to the requested scope.
These events carry the original single Meta object in data and are separate
from native session events.
Once the observer is ready, read cloud::chats::list and cloud::messages::list
to reconcile retained state and gaps. Repeat reconciliation after a
connection gap or target failure: Cloud delivery is best effort, deduplicated
and bounded, with no target retry or event polling endpoint. An archive is
current retained state, not a receipt-transition log. Local sends do not emit
message.received; use later webhook statuses to establish delivery, and inspect
the archive before retrying a send with an uncertain outcome.