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

# SMS Integration and Action

Enable your agent to send SMS notifications like appointment reminders, ticket confirmations, order updates, discount codes, and more — all directly from Gnani Agents using Twilio.

***

### **Why Integrate SMS?**

With SMS integration, your agent can:

* Send **appointment reminders** to reduce no-shows.
* Deliver **order updates** and **ticket confirmations** instantly.
* Share **promotional offers** or **discount codes** with customers.

***

## 1. Steps to Integrate

1. **Open Integration Settings**
   * Go to \*\*Integration \*\*section in your Manage Agent page.
   * Add a new integration. Select SMS.
   * Select **Twilio** as the operator and enter a name for your integration.
2. **Get Twilio Credentials**
   * Open the [Twilio Console Dashboard](https://console.twilio.com/dashboard) to retrieve credentials.
   * Copy your **Account SID** (34- character alphanumeric identifier starts with `AC`) and **Auth Token** from the **Account Info** section.
   * Paste these into the integration form in Gnani Agents.
3. **Choose Sender Type**
   \*\*Option A — Phone Number \*\*to send messages from a fixed number for consistent branding.
   * In Twilio: Go to **Develop → Phone Numbers → Manage → Active Numbers**.
   * Select an active **SMS-enabled** number and paste it into Gnani Agents.
   * If you don’t have one, click **Buy a Number** in Twilio.
     \*\*Option B — Messaging Service \*\*to use a pool of numbers for sending SMS dynamically based on factors like location and compliance.
   * In Twilio: Go to **Develop → Messaging → Services**.
   * Copy the **Messaging Service SID** (starts with `MG`) and paste it into Gnani Agents.
   * If you don’t have one, click **Create Messaging Service** in Twilio.
4. **Save**
   * Click **Save** to complete the integration.

***

## **2. Create an SMS Action**

1. **Navigate to Actions**
   * Go to **Manage Agents → Select Agent → Action Tab**.
2. **Create Action**
   * Click **+** to open the **Create Action** card.
3. **Fill in Details**
   * **Name:** Use only letters, numbers, or underscores.
   * **Description:** Describe when the action should trigger.
     * Example: *"Trigger this action when the user asks about available offers."*
4. **Select Integration**
   * Choose the Twilio SMS integration you set up earlier.
5. **Choose Trigger**
   * **Post-Call:** Executes after the conversation ends.
     * If **Post-Call** is selected, you can:
       * Add **Variables** (sent to the API).
   * **On-Call:** Executes during the conversation.
     * If **On-Call** is selected, you can:
       * Write a message in the **Speak During Action** section (what the agent says when executing).
       * Add **Before API Call Variables** (sent to the API). Create new variables or reuse existing ones to store dynamic values like names, order IDs, or dates.
       * Add **After API Call Variables** (received from the API).
6. **Message Template**
   * Enter the SMS content to send. Use variables for dynamic content.
   * Example: `Hello {{user_name}}, your order {{order_id}} is on the way! `

***

## **3. Test Your SMS Action**

Before using the action in real conversations, test it to ensure it’s working correctly.

1. **Open Testing Mode**
   * Go to **Manage Agents → Select Agent → Test**.
2. **Start a Test Conversation**
   * Speak or chat with your agent inside the test interface.
3. **Trigger the Action**
   * Ask the agent for similar instructions or keywords mentioned in the Action’s **Description**.
     * Example: If your description says *"Trigger this when user asks about offers"*, say **"What offers do you have?"**.
4. **Check SMS Delivery**
   * Confirm the SMS arrives at the configured number.
   * Ensure placeholders (e.g., `{{user_name}}`) are replaced with actual values.
5. **Troubleshoot if Needed**
   * Click on the more options on your created action card to see the **View Logs** option. You can check the **Action Logs** here.
   * Verify Twilio credentials and sender configuration.
   * Make sure the test number is SMS-enabled.
   * Review triggers, message template, and variables for errors.

***

✅ **You’re ready!** Your agent can now send automated, personalized SMS messages during or after calls.
