SendPulse MCP Server
by Sudo-psc
README.md
# SendPulse MCP Server
A Model Context Protocol (MCP) server that provides comprehensive integration with SendPulse's APIs, enabling automated WhatsApp bot management, SMS campaigns, contact handling, messaging, and flow control.
## Features
This MCP server implements all major SendPulse API functionalities:
### 📱 SMS Campaign Management
- Create and send SMS campaigns to mailing lists or specific phone numbers
- Schedule SMS campaigns for future delivery
- Calculate SMS costs before sending
- Manage SMS contacts and mailing lists
- Add/remove phone numbers from SMS blacklist
- Track SMS delivery and campaign statistics
### 🤖 Bot Management
- List all WhatsApp bots with detailed information
- Get specific bot details including status and statistics
### 👥 Contact Management
- List, create, update, and delete contacts
- Manage contact tags and custom variables
- Bulk contact operations support
### 💬 Messaging
- Send text messages with rich media (images, documents)
- Send interactive messages with buttons
- Send template messages with dynamic parameters
- Support for multiple media types and attachments
### 🔄 Flow Management
- List all available flows
- Launch flows for specific contacts
- Pass custom variables to flows
### ⚡ Trigger Management
- List all triggers
- Create keyword-based triggers
- Connect triggers to flows
### 💬 Live Chat
- Access chat history
- Retrieve chat messages
- Filter chats by status
### 🏷️ Additional Features
- Template management
- Tag operations
- Variable management
- Comprehensive error handling
- Automatic token refresh
## Installation
### Quick Install (Recommended)
The easiest way to install is using the automated installation scripts:
#### macOS
```bash
git clone https://github.com/yourusername/sendpulse-mcp.git
cd sendpulse-mcp
./install-mac.sh
```
#### Windows
```cmd
git clone https://github.com/yourusername/sendpulse-mcp.git
cd sendpulse-mcp
install-windows.bat
```
#### Linux or Cross-platform
```bash
git clone https://github.com/yourusername/sendpulse-mcp.git
cd sendpulse-mcp
node configure.js
```
The installation scripts will:
- ✅ Check Node.js installation
- ✅ Install npm dependencies
- ✅ Set up your API credentials
- ✅ Configure Claude Desktop automatically
- ✅ Test the server connection
### Manual Installation
1. Clone the repository:
```bash
git clone https://github.com/yourusername/sendpulse-mcp.git
cd sendpulse-mcp
```
2. Install dependencies:
```bash
npm install
```
3. Set up environment variables:
```bash
cp .env.example .env
```
4. Edit `.env` file with your SendPulse API credentials:
```
SENDPULSE_API_ID=your_api_id_here
SENDPULSE_API_SECRET=your_api_secret_here
```
To obtain your API credentials:
1. Log in to your SendPulse account
2. Go to Account Settings → API tab
3. Enable REST API
4. Copy your API ID and Secret
### Verify Installation
Run the verification script to ensure everything is set up correctly:
```bash
node verify-installation.js
```
### Uninstall
To remove the MCP server from Claude Desktop:
```bash
node uninstall.js
```
## Usage
### Starting the Server
Run the MCP server:
```bash
npm start
```
For development with auto-reload:
```bash
npm run dev
```
### Authentication Methods
This MCP server supports two methods for authentication:
#### 1. Environment Variables (Default)
Set credentials in your environment or Claude Desktop configuration:
```bash
SENDPULSE_API_ID=your_api_id_here
SENDPULSE_API_SECRET=your_api_secret_here
```
#### 2. Runtime Configuration (New!)
Configure credentials at runtime using the `configure_auth` tool. This is useful when:
- You want to switch between multiple SendPulse accounts
- Credentials need to be provided dynamically
- You prefer not to store credentials in environment variables
**configure_auth** - Configure API credentials at runtime
```json
{
"api_id": "your_api_id_here",
"api_secret": "your_api_secret_here"
}
```
The server will validate the credentials immediately and use them for all subsequent API calls. This overrides any environment variables.
**Priority**: Runtime credentials (via `configure_auth`) take precedence over environment variables.
### Available Tools
#### Bot Management
**get_bots** - Get list of WhatsApp bots
```json
{
"limit": 100,
"offset": 0
}
```
**get_bot** - Get information about a specific bot
```json
{
"bot_id": "bot_123"
}
```
#### Contact Management
**get_contacts** - Get list of contacts
```json
{
"bot_id": "bot_123",
"limit": 100,
"offset": 0
}
```
**create_contact** - Create a new contact
```json
{
"bot_id": "bot_123",
"phone": "+1234567890",
"name": "John Doe",
"tags": ["customer", "vip"],
"variables": {
"city": "New York",
"subscription": "premium"
}
}
```
**update_contact** - Update existing contact
```json
{
"bot_id": "bot_123",
"contact_id": "contact_456",
"name": "John Smith",
"tags": ["updated"],
"variables": {
"status": "active"
}
}
```
**delete_contact** - Delete a contact
```json
{
"bot_id": "bot_123",
"contact_id": "contact_456"
}
```
#### Messaging
**send_message** - Send a message to WhatsApp
```json
{
"bot_id": "bot_123",
"phone": "+1234567890",
"text": "Hello! This is a test message.",
"buttons": [
{
"text": "Option 1",
"callback_data": "option_1"
},
{
"text": "Option 2",
"callback_data": "option_2"
}
]
}
```
**send_template_message** - Send a template message
```json
{
"bot_id": "bot_123",
"phone": "+1234567890",
"template_id": "template_789",
"language_code": "en",
"parameters": ["John", "Order #123"]
}
```
#### Flow Management
**get_flows** - Get list of flows
```json
{
"bot_id": "bot_123"
}
```
**launch_flow** - Launch a flow for contact
```json
{
"bot_id": "bot_123",
"flow_id": "flow_456",
"phone": "+1234567890",
"variables": {
"source": "api",
"campaign": "summer2024"
}
}
```
#### Trigger Management
**get_triggers** - Get list of triggers
```json
{
"bot_id": "bot_123"
}
```
**create_trigger** - Create a new trigger
```json
{
"bot_id": "bot_123",
"name": "Welcome Trigger",
"type": "keyword",
"flow_id": "flow_456",
"keywords": ["start", "hello", "hi"]
}
```
#### Live Chat
**get_chats** - Get list of chats
```json
{
"bot_id": "bot_123",
"status": "open",
"limit": 50,
"offset": 0
}
```
**get_chat_messages** - Get messages from a chat
```json
{
"bot_id": "bot_123",
"chat_id": "chat_789",
"limit": 100,
"offset": 0
}
```
#### Additional Tools
**get_templates** - Get message templates
```json
{
"bot_id": "bot_123"
}
```
**add_tag** - Add tag to contact
```json
{
"bot_id": "bot_123",
"contact_id": "contact_456",
"tag": "premium"
}
```
**remove_tag** - Remove tag from contact
```json
{
"bot_id": "bot_123",
"contact_id": "contact_456",
"tag": "trial"
}
```
**set_variable** - Set contact variable
```json
{
"bot_id": "bot_123",
"contact_id": "contact_456",
"variable_name": "last_purchase",
"variable_value": "2024-01-15"
}
```
#### SMS Management
**create_sms_campaign** - Create and send SMS campaign
```json
{
"sender": "MyCompany",
"text": "Hello! Special offer for you: 50% off. Reply STOP to unsubscribe.",
"phones": ["+1234567890", "+0987654321"],
"list_id": 123,
"track_links": true,
"send_date": "2024-01-15 14:30:00",
"test": false
}
```
**send_sms_to_phone** - Send SMS to specific phone numbers
```json
{
"sender": "MyCompany",
"text": "Your order #123 has been shipped!",
"phones": ["+1234567890"],
"route": "premium",
"track_links": false
}
```
**add_sms_contacts** - Add phone numbers to SMS mailing list
```json
{
"list_id": 123,
"phones": [
{
"phone": "+1234567890",
"variables": {
"name": "John",
"city": "New York"
}
}
]
}
```
**update_sms_contact** - Update SMS contact information
```json
{
"list_id": 123,
"old_phone": "+1234567890",
"new_phone": "+1234567891",
"variables": {
"name": "John Smith",
"status": "active"
}
}
```
**remove_sms_contact** - Remove contact from SMS list
```json
{
"list_id": 123,
"phone": "+1234567890"
}
```
**get_sms_campaigns** - Get SMS campaigns by date range
```json
{
"start_date": "2024-01-01",
"end_date": "2024-01-31"
}
```
**get_sms_campaign_info** - Get specific SMS campaign details
```json
{
"campaign_id": 456
}
```
**cancel_sms_campaign** - Cancel scheduled SMS campaign
```json
{
"campaign_id": 456
}
```
**calculate_sms_cost** - Calculate SMS campaign cost
```json
{
"text": "Your message text here",
"phones": ["+1234567890", "+0987654321"],
"route": "premium"
}
```
**get_sms_phone_info** - Get information about phone number
```json
{
"phone": "+1234567890"
}
```
**add_to_sms_blacklist** - Add numbers to SMS blacklist
```json
{
"phones": ["+1234567890"],
"comment": "User requested removal"
}
```
**remove_from_sms_blacklist** - Remove numbers from SMS blacklist
```json
{
"phones": ["+1234567890"]
}
```
## Integration with Claude Desktop
To use this MCP server with Claude Desktop, add the following configuration to your Claude Desktop config file:
### macOS
Edit `~/Library/Application Support/Claude/claude_desktop_config.json`:
```json
{
"mcpServers": {
"sendpulse": {
"command": "node",
"args": ["/path/to/sendpulse-mcp/index.js"],
"env": {
"SENDPULSE_API_ID": "your_api_id",
"SENDPULSE_API_SECRET": "your_api_secret"
}
}
}
}
```
### Windows
Edit `%APPDATA%\Claude\claude_desktop_config.json`:
```json
{
"mcpServers": {
"sendpulse": {
"command": "node",
"args": ["C:\\path\\to\\sendpulse-mcp\\index.js"],
"env": {
"SENDPULSE_API_ID": "your_api_id",
"SENDPULSE_API_SECRET": "your_api_secret"
}
}
}
}
```
## API Rate Limits
SendPulse API has the following rate limits:
- **Free Plan**: 1,000 requests/minute, 500,000 requests/day
- **Standard Plan**: 2,000 requests/minute, 1 million requests/day
- **Enterprise Plan**: 3,000 requests/minute, 3 million requests/day
The server automatically handles rate limiting and will retry requests when necessary.
## Error Handling
The server includes comprehensive error handling:
- Automatic token refresh when expired
- Detailed error messages for debugging
- Graceful handling of API errors
- Request retry logic for transient failures
## Security
- Never commit your `.env` file
- Keep your API credentials secure
- Use environment variables for sensitive data
- Regularly rotate your API credentials
## Troubleshooting
### Authentication Issues
- Ensure your API credentials are correct
- Check if REST API is enabled in your SendPulse account
- Verify your account has access to WhatsApp and SMS features
### Connection Issues
- Check your internet connection
- Verify the SendPulse API is accessible
- Check for any firewall or proxy restrictions
### Missing Features
- Some endpoints may require specific SendPulse plan features
- Verify your account has access to WhatsApp Bot API and SMS features
- Check SendPulse documentation for feature availability
## Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
## License
This project is licensed under the MIT License - see the LICENSE file for details.
## Support
For issues related to:
- **This MCP server**: Open an issue on GitHub
- **SendPulse API**: Contact SendPulse support
- **MCP Protocol**: See the MCP documentation
## Disclaimer
This is an unofficial integration and is not affiliated with or endorsed by SendPulse.This server cannot be deployed
Maintenance
ActivityInactive
ResponsivenessNo recent community issues