> ## Documentation Index
> Fetch the complete documentation index at: https://docs.decodahealth.com/llms.txt
> Use this file to discover all available pages before exploring further.

# AI Texting

> Review AI-generated responses, enable AI-powered appointment scheduling over SMS, and execute AI actions.

<Info>
  **Where AI suggestions appear:** On the full **Comms > Chat** page only. They do not appear in the mini chat windows that pop up elsewhere in the platform.
</Info>

<Info>
  **Prerequisites:** Your organization needs an AI texting assistant configured under **Settings > Assistants > Texting**. A primary patient must be set on the conversation for suggestions to appear. See [Assistants Settings](/modules/settings/assistants) for setup details.
</Info>

When a patient sends your clinic a text message, the AI assistant can generate a suggested response. Instead of writing every reply from scratch, you can review the suggestion, send it as-is, tweak it, or dismiss it and write your own.

## What AI Suggestions Look Like

After a patient sends a message, a highlighted card appears below their message in the conversation. This card is labeled **Suggested Response** with an AI badge. It contains the AI's draft reply and three actions:

* **Use** -- Send the suggestion as your reply.
* **Regenerate** (redo icon) -- Ask the AI to rewrite the suggestion with your feedback.
* **Dismiss** (X icon) -- Remove the suggestion and write your own reply.

The suggestion stays visible until you use it, dismiss it, or the patient sends another message.

## Use a Suggestion

If the AI's suggestion looks good, click **Use**. The message is sent to the patient immediately, just as if you had typed it yourself. The conversation is automatically marked as resolved.

<Info>
  **Tip:** Always read the full suggestion before clicking Use. The AI pulls from the patient's records and your clinic's settings, but it can occasionally get a detail wrong -- especially appointment times or provider names. A quick glance takes seconds and prevents confusion.
</Info>

## Regenerate a Suggestion

If the suggestion is close but not quite right, click the regenerate icon. A window titled **"What is wrong with this response?"** opens with a text area where you can tell the AI what to change. For example:

* "Make it shorter"
* "Include the appointment date and time"
* "Use a warmer tone"
* "Don't mention the payment -- just confirm the appointment"

Type your feedback and click **Submit**. The AI generates a new suggestion based on your instructions.

<Info>
  **Your feedback makes the AI smarter over time.** When you tell the AI what to fix, it uses that feedback to improve future suggestions -- not just for this conversation, but across your clinic. The more specific your feedback, the better the results.
</Info>

## Dismiss a Suggestion

Click the **X** icon to dismiss the suggestion and write your own reply. There's no penalty for dismissing -- the AI will still suggest replies on the next incoming message.

## AI Actions

The AI doesn't just suggest text replies. It can also suggest **actions** -- things like sending an invoice, notifying the billing team, or texting a form link to the patient. When the AI suggests an action instead of a text reply, you'll see:

* The action name (e.g., "Send Text Invoice" or "Notify Billing Staff")
* A description of what the action will do
* An **Execute** button instead of a "Use" button

Click **Execute** to carry out the action. Once executed, the button changes to **Executed** and can't be clicked again.

<Info>
  AI actions save your team real time. Instead of switching to the Billing page to create an invoice, the AI can handle it from right within the conversation. But always review the action description before executing -- make sure the right patient, amount, or form is being referenced.
</Info>

## When to Trust the AI vs. Write Your Own Reply

The AI works best for common, routine messages:

* Confirming or rescheduling appointments
* Answering questions about office hours or location
* Directing patients to the right department
* Sending payment or form links

Consider writing your own reply when:

* The patient is upset or dealing with a sensitive situation
* The message involves a clinical decision or medical advice
* You need to communicate something nuanced that the AI might oversimplify
* The AI's suggestion doesn't sound like something your clinic would say

## Configure the AI Texting Assistant

The AI assistant's behavior is controlled by settings under **Settings > Assistants > Texting**:

| Setting            | What It Controls                                                                                                                                                                              |
| ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Assistant Name** | The display name on AI-generated messages.                                                                                                                                                    |
| **Custom Prompt**  | Instructions for tone, length, specific phrases, and what topics to avoid. This is the most powerful setting -- the more specific your prompt, the better the AI matches your clinic's voice. |
| **AI Model**       | Which AI model generates suggestions.                                                                                                                                                         |
| **Phone Number**   | The phone number used for outbound AI messages.                                                                                                                                               |

See [Assistants Settings](/modules/settings/assistants) for the full setup guide.

## AI Scheduling

When the right tools are enabled on the Inbound Texting assistant, the AI can handle appointment booking, cancellation, rescheduling, and confirmation entirely over text — without staff involvement.

### What the AI Can Do

| Action                        | What Happens                                                                                                                                                       |
| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Book an appointment**       | The AI finds available slots, presents options, discloses any booking fees, confirms details with the patient, and creates the appointment.                        |
| **Cancel an appointment**     | The AI identifies the appointment, states any cancellation fee, waits for patient confirmation, cancels, then asks if the patient wants help finding another time. |
| **Reschedule an appointment** | The AI finds a new slot, confirms the change with the patient, and moves the existing appointment. Previously paid booking fees are not charged again.             |
| **Confirm an appointment**    | When a patient replies to a reminder with "yes", "confirm", or similar, the AI confirms all pending appointments within the reminder window.                       |
| **Escalate to staff**         | If the AI cannot help (clinical question, fee dispute, complaint), it contacts a staff member with the patient's name and request details.                         |

### Enable AI Scheduling

To turn on scheduling, enable the relevant tools on the Inbound Texting assistant under **Settings > AI Assistants > Inbound Texting > Tools**.

| Tool                         | What It Enables                                                             |
| ---------------------------- | --------------------------------------------------------------------------- |
| **FindAvailability**         | Searches for open appointment slots. Required for booking and rescheduling. |
| **CreateAppointment**        | Allows the AI to book new appointments.                                     |
| **CancelAppointment**        | Allows the AI to cancel appointments and handle fee disclosure.             |
| **RescheduleAppointment**    | Allows the AI to reschedule existing appointments.                          |
| **ConfirmAppointment**       | Allows the AI to confirm pending appointments from reminder replies.        |
| **ListProvidersAndServices** | Allows the AI to look up providers, services, locations, and pricing.       |

<Info>
  If you enable booking or rescheduling, make sure **FindAvailability** is also enabled — the AI needs it to search for open slots.
</Info>

Each tool is opt-in. The AI only offers capabilities for the tools you have enabled. For example, if you enable **CreateAppointment** but not **CancelAppointment**, patients can book over text but will need to call to cancel.

### How Booking Works

When a patient texts asking to book an appointment, the AI follows this flow:

<Steps>
  <Step title="Gather Requirements">
    The AI asks the patient what service they need, and optionally their preferred provider, location, or time. If the patient has a preferred provider or primary location on file, the AI uses those as defaults.
  </Step>

  <Step title="Disclose Fees">
    If the service has a booking fee, the AI tells the patient the exact amount and the cancellation fee policy before searching for availability. The patient must acknowledge before the AI proceeds.
  </Step>

  <Step title="Find Availability">
    The AI searches for open slots (up to 10 at a time, within a 14-day window) and presents them conversationally — for example, "We have openings on Friday at 9:15 AM and 10:00 AM."
  </Step>

  <Step title="Confirm with the Patient">
    The AI restates the service, provider, date, time, and location, and waits for the patient to confirm. The AI never books without explicit confirmation.
  </Step>

  <Step title="Create the Appointment">
    Once confirmed, the AI books the appointment and sends a confirmation message. If a booking fee is required, the AI sends a secure payment link with a deadline.
  </Step>
</Steps>

### How Cancellation Works

<Steps>
  <Step title="Identify the Appointment">
    The AI finds the appointment to cancel, either from context in the conversation or by looking up the patient's upcoming appointments.
  </Step>

  <Step title="Check for Fees">
    If the appointment is within the service's cancellation window, the AI tells the patient the exact fee amount. There are two fee models:

    * **Flat fee** -- a fixed dollar amount if within the cancellation window.
    * **Percentage-based tiers** -- a percentage of the service price, with different rates for within 24 hours vs. within 48 hours. Any previously paid booking fee is credited against the cancellation fee.
  </Step>

  <Step title="Get Patient Confirmation">
    The patient must confirm they accept the fee before the AI cancels. If the patient refuses, the AI does not cancel and escalates to staff instead.
  </Step>

  <Step title="Offer Another Time">
    After the cancellation is complete, the AI asks whether the patient wants help finding another time. If the patient says yes, the AI searches for options and books the replacement as a new appointment after the patient picks a time.
  </Step>
</Steps>

<Info>
  The AI cannot waive or reduce fees. Fee disputes are always escalated to a staff member.
</Info>

### How Rescheduling Works

The AI uses rescheduling when a patient wants to move an appointment that is still on the calendar. It finds options, confirms the new time, and moves the existing appointment. If a patient says something like "cancel it and move it to next week" in one request, the AI treats that as rescheduling instead of cancelling first.

If the appointment has already been cancelled and the patient later wants another time, the AI searches for options and books a new appointment instead.

<Warning>
  Appointments within 24 hours cannot be rescheduled by the AI. This is a hard limit. The AI will let the patient know and escalate to staff.
</Warning>

If the patient already paid a booking fee for the original appointment, the new appointment is created without charging the fee again.

### Identifying AI-Created Appointments

Appointments booked or rescheduled by the AI are labeled with the note **"Scheduled by Decoda."** in the appointment record. Cancellations made by the AI include **"via AI Conversation"** in the cancellation reason.

### Safeguards

The AI has several built-in safeguards:

* **Fees are always disclosed before action.** Booking fees are disclosed before searching for availability. Cancellation fees are disclosed before cancelling.
* **Patient confirmation is required.** The AI reads back the full appointment details and waits for a "yes" before booking or cancelling.
* **Complaints are escalated, not cancelled.** If a patient wants to cancel because of a bad experience, the AI contacts staff instead of proceeding — giving your team a chance to retain the patient.
* **Patient identity is validated.** The AI checks that the patient has a first and last name on file before booking. If not, it asks the patient for their name first.
* **Emergencies are redirected.** The AI advises patients to contact emergency services for medical emergencies.
* **Language matching.** The AI responds in the same language the patient uses.

### Limitations

* The AI searches up to 14 days ahead by default for availability.
* Appointments within 24 hours cannot be rescheduled (cancellation is still possible with fee disclosure).
* The AI cannot waive fees, provide medical advice, or modify provider schedules.
* If the AI cannot find availability after trying different dates, times, and providers, it shares your clinic's self-scheduling link as a fallback.
