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

# WhatsApp MCP Integration

> Guide for integrating WhatsApp messaging with PraisonAI agents using MCP

## Add WhatsApp Tool to AI Agent

```mermaid theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
flowchart LR
    In[In] --> Agent[AI Agent]
    Agent --> Tool[WhatsApp MCP]
    Tool --> Agent
    Agent --> Out[Out]
    
    style In fill:#8B0000,color:#fff
    style Agent fill:#2E8B57,color:#fff
    style Tool fill:#25D366,color:#fff
    style Out fill:#8B0000,color:#fff
```

## Quick Start

<Steps>
  <Step title="Set Up WhatsApp MCP Server">
    Clone and set up the WhatsApp MCP server:

    ```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
    git clone https://github.com/lharries/whatsapp-mcp.git
    cd whatsapp-mcp
    cd whatsapp-bridge
    go run main.go
    ```
  </Step>

  <Step title="Create a file">
    Create a new file `whatsapp_message.py` with the following code:

    ```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
    from praisonaiagents import Agent, MCP

    whatsapp_agent = Agent(
        instructions="Whatsapp Agent",
        llm="gpt-4o-mini",
        tools=MCP("python /path/to/whatsapp-mcp/whatsapp-mcp-server/main.py")
    )

    whatsapp_agent.start("Send Hello to Mervin Praison")
    ```

    Note: Replace `/path/to/whatsapp-mcp` with the actual path to your WhatsApp MCP server.
  </Step>

  <Step title="Install Dependencies">
    Make sure you have the required packages installed:

    ```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
    pip install "praisonaiagents[llm]" mcp gradio
    ```
  </Step>

  <Step title="Export API Key">
    ```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
    export OPENAI_API_KEY="your_api_key"
    ```
  </Step>

  <Step title="Run the Agent">
    Execute your script:

    ```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
    python whatsapp_message.py
    ```
  </Step>
</Steps>

<Note>
  **Requirements**

  * Python 3.10 or higher
  * WhatsApp MCP server set up and configured
</Note>

## Multi-Agent Integration

You can also combine WhatsApp with other MCP tools, such as Airbnb search:

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonaiagents import Agent, AgentTeam, MCP

airbnb_agent = Agent(
    instructions="""Search for Apartments in Paris for 2 nights on Airbnb. 04/28 - 04/30 for 2 adults""",
    llm="gpt-4o-mini",
    tools=MCP("npx -y @openbnb/mcp-server-airbnb --ignore-robots-txt")
)

whatsapp_agent = Agent(
    instructions="""Send AirBnb Search Result to 'Mervin Praison'""",
    llm="gpt-4o-mini",
    tools=MCP("python /path/to/whatsapp-mcp/whatsapp-mcp-server/main.py")
)

agents = AgentTeam(agents=[airbnb_agent, whatsapp_agent])

agents.start()
```

## Alternative LLM Integrations

### Using Groq with WhatsApp

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonaiagents import Agent, MCP

whatsapp_agent = Agent(
    instructions="Whatsapp Agent",
    llm="groq/llama-3.2-90b-vision-preview",
    tools=MCP("python /path/to/whatsapp-mcp/whatsapp-mcp-server/main.py")
)

whatsapp_agent.start("Send Hello to Mervin Praison")
```

### Using Ollama with WhatsApp

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonaiagents import Agent, MCP

whatsapp_agent = Agent(
    instructions="Whatsapp Agent",
    llm="ollama/llama3.2",
    tools=MCP("python /path/to/whatsapp-mcp/whatsapp-mcp-server/main.py")
)

whatsapp_agent.start("Send Hello to Mervin Praison. Use send_message tool, recipient and message are the required parameters.")
```

## Gradio UI Integration

Create a Gradio UI for your WhatsApp and Airbnb integration:

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonaiagents import Agent, AgentTeam, MCP
import gradio as gr

def search_airbnb(query):
    airbnb_agent = Agent(
        instructions=query+" on Airbnb",
        llm="gpt-4o-mini",
        tools=MCP("npx -y @openbnb/mcp-server-airbnb --ignore-robots-txt")
    )

    whatsapp_agent = Agent(
        instructions="""Send AirBnb Search Result to 'Mervin Praison'. Don't include Phone Number in Response, but include the AirBnb Search Result""",
        llm="gpt-4o-mini",
        tools=MCP("python /path/to/whatsapp-mcp/whatsapp-mcp-server/main.py")
    )

    agents = AgentTeam(agents=[airbnb_agent, whatsapp_agent])

    result = agents.start()
    return f"## Airbnb Search Results\n\n{result}"

demo = gr.Interface(
    fn=search_airbnb,
    inputs=gr.Textbox(placeholder="I want to book an apartment in Paris for 2 nights..."),
    outputs=gr.Markdown(),
    title="WhatsApp MCP Agent",
    description="Enter your booking requirements below:"
)

if __name__ == "__main__":
    demo.launch()
```

## Features

<CardGroup cols={2}>
  <Card title="WhatsApp Messaging" icon="message">
    Send messages to WhatsApp contacts directly from your AI agent.
  </Card>

  <Card title="Multi-Agent Support" icon="users">
    Combine WhatsApp with other MCP tools for complex workflows.
  </Card>

  <Card title="Multiple LLM Options" icon="brain">
    Use with OpenAI, Groq, Ollama, or other supported LLMs.
  </Card>

  <Card title="Gradio UI" icon="window">
    Create user-friendly interfaces for your WhatsApp integrations.
  </Card>
</CardGroup>
