create_campaign
Create email campaigns in Mailchimp by specifying recipients, subject line, sender details, and campaign type to send marketing communications.
Instructions
Create a new email campaign. Returns the campaign ID. Type: regular, plaintext, absplit, rss.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| list_id | Yes | ||
| subject_line | Yes | ||
| from_name | Yes | ||
| reply_to | Yes | ||
| title | No | ||
| preview_text | No | ||
| campaign_type | No | regular |
Implementation Reference
- mcp_mailchimp/server.py:132-161 (handler)The implementation of the create_campaign tool, which handles the request to create a new email campaign in Mailchimp.
async def create_campaign( list_id: str, subject_line: str, from_name: str, reply_to: str, title: str = "", preview_text: str = "", campaign_type: str = "regular", ) -> str: """Create a new email campaign. Returns the campaign ID. Type: regular, plaintext, absplit, rss.""" mc = get_client() body: dict[str, Any] = { "type": campaign_type, "recipients": {"list_id": list_id}, "settings": { "subject_line": subject_line, "from_name": from_name, "reply_to": reply_to, "title": title or subject_line, }, } if preview_text: body["settings"]["preview_text"] = preview_text c = await mc.post("/campaigns", json=body) return _fmt({ "id": c["id"], "status": c.get("status", ""), "title": c.get("settings", {}).get("title", ""), "message": "Campaign created successfully.", })