]> git.giacomolli.uk - onechat/commit
Send WhatsApp messages with an ID
authorAnderson A. Giacomolli <redacted>
Sun, 8 Nov 2026 15:26:50 +0000 (12:26 -0300)
committerAnderson A. Giacomolli <redacted>
Sun, 8 Nov 2026 15:26:50 +0000 (12:26 -0300)
commit6e7c7f3d47f086b9d59fe40b91fb071e1528684e
tree1127ae17d078f01dd2bb2d1d7ffdc373f9fea7f3
parentf0604a9ebbee5783d5213d6176191535f4ed335b
Send WhatsApp messages with an ID

The agent gets the tool whatsapp_send, which sends a text message to a
private chat or a group by its ID, only when the user asks for it. Each
call has an ID that the agent gives. The state file keeps a record of
each send by its ID, so a repeated call gives the answer of the first
call and sends nothing, and the same ID with another chat or text is an
error. The record "sending" is durable before the send, so a stop of the
daemon during a send gives an answer that the result is unknown and that
the agent must ask the user, and never a second send. A disconnected
WhatsApp sends nothing and makes no record.

The state file keeps the last 1000 send records with the batches. Its
type is now WhatsAppState in whatsapp_state.go, because it holds more
than the batches, and whatsapp_batch.go keeps the batch, its text, and
its turn rule.

The send tool takes only the ID of a private chat or a group, and not
the chat of the user with itself, and the own number in an error shows
as OWN. Only the root agent has the tool, and its new schema makes the
prompt cache miss once.

Issue: 6f69ca1
README.rst
prompt.go
prompt_test.go
tools.go
whatsapp.go
whatsapp_batch.go
whatsapp_batch_test.go
whatsapp_fake_helper_test.go
whatsapp_state.go [new file with mode: 0644]
whatsapp_state_test.go [new file with mode: 0644]
whatsapp_test.go