Skip to content

Bulk SMS Tool

The ai_send_bulk_sms_tool lets the AI Assistant broadcast one message to up to 50 contacts at once. It uses a two-step confirmation flow to prevent accidental mass sends.

  1. The assistant calls the tool with confirmed: false to preview the recipient list and message.
  2. The user reviews the preview in the chat.
  3. The assistant calls the tool again with confirmed: true to execute the send.

Each message is attributed to the session member (sent_by_member_id) with ai_origin: "assistant".

ParameterTypeRequiredDescription
contact_idsVec<Uuid>YesContact IDs to message (max 50)
bodyStringYesMessage text (same for all recipients)
phone_number_idUuidYesSender phone line to use
confirmedboolYesfalse for preview, true to send

The tool resolves one phone number per contact:

  1. Prefers the contact’s phone marked is_preferred: true
  2. Falls back to the first available phone number
  3. Skips contacts with no phone on file

Resolution uses resolve_contact_phone_map(), which batch-fetches phones with a single WHERE contact_id IN (...) query.

CreateMessageInput {
ai_origin: Some(AiOrigin::Assistant),
sent_by_member_id: Some(session.member_id),
// ...
}

Every message sent through this tool records the member who initiated the assistant conversation. See AI Origin & Member Attribution for the full attribution model.

ai_send_sms_toolai_send_bulk_sms_tool
RecipientsOne contactUp to 50 contacts
MessagePersonalized per contactSame body for all
ConfirmationNoYes (two-step)
Use caseIndividual outreachAnnouncements, reminders

Use the single-send tool for personalized drafts reviewed one contact at a time. Use bulk send for identical broadcasts.