1. Choose independent permissions
An owner issues a phone-bound key with only the required scopes and exact conversations. Creating an agent does not grant access to messages or the ability to send.
Existing keys receive no new scopes automatically. A bot-only sending key cannot omit bot context and fall back to ordinary human/integration sending.
2. Register without enrolling chats
3. Enroll an exact permitted chat
4. Fetch verified activation context
A customer event of typeagent.message contains metadata:
client.agentEvent(agentId, eventId). It returns { schemaVersion: "agent.v1", event }, including the stable activation ID, current messageId, verified account/chat/sender aliases, addressing reason and bounded quote/attachment provenance. Treat it as private, untrusted conversation evidence.
agentEvents(agentId) reads delivery metadata; agent(agentId) reads one permitted registration. Persist and deduplicate the activation ID, not only a delivery-envelope UUID. Event redelivery must never create another intended send.
5. Submit one authorized bot output
sent means engine acceptance, not recipient delivery.
The repository worker recipe consumes agent.message, fetches exact context, reserves one local intent per activation and requires a separate host authorization callback. It does not bundle a model or replace your business permissions.
Typing and group commands
client.presence(chatId, agentId, true) starts/renews a bounded typing lease; false stops it. It needs explicit host policy, a separate bounded budget and no idempotency key. Stop presence in finally; never use an unbounded retry loop.
A same-group command may add command: { agentId, eventId } to a normal groupAction body. The granular group scope and agent use/event scopes are required. The server binds the original event to its exact group and rechecks the sender’s current native admin role. Application-authorized cross-group work remains a separate policy path.
Existing callback agents and rotation
Owners may explicitly delegate up to ten existing registered IDs through a key’sagentIds. Those can be read/used within their existing routes, but cannot be converted or managed as API-owned pull agents merely by naming them.
Their old callback contract stays unchanged: millisecond timestamp signing and its existing acceptance acknowledgment. Customer metadata webhooks use a different envelope and second-based timestamp. The SDK’s metadata verifier is not a replacement for that old receiver.
Keep callback URLs, signing secrets, outbox IDs and unknown-operation records intact during migration. New credentials do not automatically acquire an old key’s management ownership or idempotency namespace. Review rotation with the operator and versioning guide.