SendSMSInformation

The SendSMSInformation action sends an SMS text message to a user during or after a conversation. The AI Employee analyzes the conversation to determine whether an SMS should be sent, validates the recipient's phone number and consent, checks for duplicates, and generates the message content from pre-configured templates. The action also handles SMS delivery errors with user-friendly messages.

Triggering events:

  • send_information_tool — Triggered when the AI Employee determines an SMS should be sent.
  • send_sms_tool — Alternative trigger for SMS sending.
  • send_sms_error — Triggered when an SMS delivery fails (from the Twilio integration). Handled by a separate error skill.

How it works

  1. The action checks whether the user has previously opted out of SMS (sms_subscribed persona attribute).
    • If opted out, the action asks the user for consent before proceeding.
    • If consent is granted, sms_subscribed is updated to "true".
  2. The action generates a schema from the allowed SMS templates.
  3. It analyzes the conversation to validate:
    • The user's phone number (with country code) is available.
    • The user confirmed the phone number is correct (or the agent promised to send).
    • The agent explicitly stated it will send an SMS.
    • Similar content has not already been sent (duplicate check).
    • The content matches an allowed template.
  4. If validation passes:
    • The message body is extracted from the matching template.
    • Placeholders are replaced with actual data from the conversation.
    • Lines with unfilled placeholders are removed.
    • Newlines in the message are preserved.
    • The content is translated to the agent's language if needed.
    • The action checks whether the agent expects a user reply.
  5. The action sends an sms_worker_send_sms system event with the recipient phone number and message text.
  6. The sent SMS is tracked in the already_sent_information persona attribute to prevent duplicates.
  7. If the agent expects a reply, the follow-up timer is disabled (set to manual reactivation mode) until the user responds.

Configuration

AttributeDescription
project_attributes_setting_sms_send_information_allowed_contentDefines allowed SMS templates and their content structure.
project_business_time_zoneTime zone for datetime formatting in message content.

Consent management

The action tracks SMS consent per user through the sms_subscribed persona attribute:

ValueBehavior
"true"User has consented. Messages are sent without asking.
"false"User has opted out. The action asks for consent before sending.
Not setFirst interaction. The action proceeds normally.

If a user has opted out and the agent needs to send an SMS, the action sends an urgent message asking the user for permission. Only if the user agrees does the action proceed and update the consent status.

Persona attributes

AttributeDescription
sms_subscribedTracks whether the user has consented to receive SMS messages.
already_sent_informationTracks previously sent message content to prevent duplicates.

System event sent

SendSystemEvent(
  eventIdn="sms_worker_send_sms",
  connectorIdn="system",
  sms_text="Your appointment is confirmed for Monday at 2 PM.",
  phone_number="+15551234567",
  notify="true"
)

SMS delivery error handling

When an SMS fails to deliver, the send_sms_error event triggers the error handling skill. The action maps Twilio error codes to user-friendly messages:

Error codeMeaningMessage to agent
30024Numeric sender ID not provisionedSMS temporarily cannot be sent.
30003Unreachable destinationSMS cannot be sent to this phone number.
21635 / 30006Landline or unreachable carrierSMS cannot be sent to a landline. Ask for a mobile number.
21211Invalid phone numberPhone number is invalid. Ask the user to clarify.
30005Unknown or inactive destinationDestination unreachable. Verify the phone is on and has signal.

The agent receives the error explanation as an urgent message and can communicate the issue to the user.

Follow-up management

ScenarioFollow-up behavior
Agent expects a reply from the userFollow-up timer is disabled (reactivation_mode="manual"). Re-enabled when the user responds.
Agent does not expect a replyFollow-up timer continues normally.

Analysis output

The structured generation produces a JSON object with the following fields:

FieldTypeDescription
user_phone_number_presenceBooleanWhether the user's phone number (with country code) is available.
user_correctness_agreementBooleanWhether the user confirmed the phone number is correct.
convo_agent_promiseBooleanWhether the agent explicitly promised to send an SMS.
message_bodyStringThe text content of the SMS (newlines preserved).
is_duplicateBooleanWhether similar content was already sent.
information_is_allowed_to_be_sentBooleanWhether the content matches an allowed template.
agent_must_send_informationBooleanFinal decision: true if the SMS should be sent.
agent_waits_user_replyBooleanWhether the agent expects the user to reply to the SMS.

Example

Configure an allowed SMS template for appointment confirmations:

project_attributes_setting_sms_send_information_allowed_content = {
  "appointment_confirmation": {
    "body": "Hi! Your appointment at [business_name] is confirmed for [appointment_date] at [appointment_time]. Address: [address]. Reply YES to confirm or call us to reschedule."
  }
}

When the AI Employee confirms an appointment during a call, it automatically sends a confirmation SMS to the user's phone number with the relevant details filled in from the conversation. If the template includes a "reply" prompt, the follow-up timer is paused until the user responds.