# Message Sending Tool

The **Message Sending** Tool allows an Agent to proactively send messages to specific phone numbers based on a defined condition or instruction.

This tool is commonly used for **notifications, alerts, internal handoffs, summaries, and operational follow-ups**, extending the Agent’s reach beyond the active conversation flow.

***

### 🔎 What It Does

With Message Sending, an Agent can:

* Send messages to **specific phone numbers**
* Choose the destination dynamically from the conversation context
* Notify internal teams or stakeholders
* Trigger outbound messages based on instructions in the Agent’s logic

Unlike Follow Ups, this tool is **not time-based by default** — messages are sent immediately when the Agent decides to execute the tool.

***

### ⚙️ How the Tool Works

The Agent decides to use the Message Sending Tool based on its **description and instructions**.

At runtime:

1. The Agent evaluates whether the condition to send a message is met.
2. It determines **who should receive the message**:
   * Using predefined phone numbers, or
   * Inferring the phone number from the conversation context.
3. It generates the message content according to the instructions you provided.
4. The message is sent through the selected connection.

***

### 📞 WhatsApp Connection Rules (Important)

#### Official WhatsApp Connection

If you select an **official WhatsApp connection**, the destination phone number **must be inside an active 24-hour conversation window**.

This means:

* The recipient must have interacted with the WhatsApp number **within the last 24 hours**.
* If the window is closed, the message **will not be delivered**.

#### Non-Official Connection

If you need to send messages **outside the 24-hour window**, you must use a **non-official WhatsApp connection**.

***

### 📲 Predefined Phone Numbers vs Dynamic Discovery

#### Use Predefined Phone Numbers (Enabled)

When enabled:

* You manually define one or more phone numbers.
* All messages sent by this tool will go only to these numbers.
* Ideal for:
  * Internal notifications
  * Admin alerts
  * Sales or support escalation messages

#### Dynamic Phone Number Discovery (Disabled)

When disabled:

* The Agent determines the destination phone number automatically.
* The number is inferred from the conversation context or instructions.
* Ideal for:
  * Notifying the same user who is interacting with the Agent
  * Context-aware routing

***

### ✍️ Defining the Message Content

The message content is controlled entirely by **prompt instructions**.

You can:

* Define a fixed message template, or
* Instruct the Agent to dynamically generate the message.

#### Example Instruction

> “When you create a support ticket, send a WhatsApp message to **11 984444444** containing:
>
> * A summary of the conversation so far
> * The user’s phone number as a clickable link in the format\
>   `https://wa.me/55{{user_phone}}`”

In this case, the Agent:

* Writes the message
* Injects context dynamically
* Sends it to the specified number

***

### 📌 Recommended Usage Pattern

We strongly recommend using a **dedicated phone number** exclusively for outbound notifications.

Reasons:

* Prevents reputation damage to primary WhatsApp numbers
* Helps control outbound message volume
* Reduces the risk of blocks or restrictions
* Keeps operational messages isolated from customer conversations

***

### 🔮 Future Capabilities

In future releases, Message Sending will support:

* **Official WhatsApp templates approved by Meta**

***

### 🧠 Best Practices

* Be explicit in the tool description so the Agent knows when to use it
* Avoid excessive outbound messages to protect number reputation
* Prefer Message Sending for **internal notifications**, not user engagement flows
* Use Follow Up instead when timing and delayed delivery matter

***

### ✅ Key Takeaway

The **Message Sending** Tool enables Agents to act beyond the conversation — notifying, alerting, and coordinating actions through outbound messages.

When combined with clear instructions and the right connection type, it becomes a powerful bridge between conversational intelligence and real-world operations.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.zaia.app/tools/available-tools/message-sending-tool.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
