n8n Integration
Build automated workflows with MCP Factory using n8n.
Overview
n8n is a powerful workflow automation tool. Integrate MCP Factory to trigger campaigns from any event and receive results via webhooks.
Authentication Setup
Create an HTTP Header Auth credential in n8n:
- Go to Credentials → Add Credential
- Select Header Auth
- Set Name:
Authorization - Set Value:
Bearer mcpf_live_xxxx
Create a Campaign
Use the HTTP Request node to launch a campaign:
Method: POST
URL: https://api.mcpfactory.org/campaigns
Headers:
Content-Type: application/json
Body:
{
"mcp": "sales-outreach",
"target_url": "{{ $json.website }}",
"target_audience": "{{ $json.audience }}",
"budget": {
"max_daily_usd": 10
},
"schedule": {
"frequency": "daily",
"trial_days": 5
},
"reporting": {
"webhook_url": "https://your-n8n-instance.com/webhook/xxx"
}
}Receive Webhook Events
Create a Webhook trigger node to receive campaign updates:
// Incoming webhook payload
{
"event": "campaign.milestone",
"campaign_id": "camp_abc123",
"data": {
"milestone": "100_emails_sent",
"stats": {
"emails_sent": 100,
"delivered": 94,
"opened": 21,
"replied": 3
}
}
}Available Webhook Events
| Event | Description |
|---|---|
campaign.started | Campaign has started |
campaign.milestone | Reached a milestone (100, 500, 1000 emails) |
campaign.paused | Campaign was paused |
campaign.completed | Campaign finished |
campaign.budget_warning | 80% of budget used |
campaign.budget_exceeded | Budget limit reached |
reply.received | Someone replied to an email |
meeting.booked | A meeting was booked |
Example Workflow: CRM Integration
Automatically add leads who reply to your CRM:
- Webhook Trigger - Receive
reply.receivedevents - IF Node - Check if reply is positive
- HTTP Request - Create lead in HubSpot/Salesforce
- Slack - Notify sales team
// Example: reply.received webhook payload
{
"event": "reply.received",
"campaign_id": "camp_abc123",
"data": {
"email": "john@prospect.com",
"name": "John Smith",
"company": "Prospect Inc",
"reply_sentiment": "positive",
"reply_preview": "Thanks for reaching out! I'd love to schedule a call..."
}
}Example Workflow: Daily Report to Slack
- Schedule Trigger - Every day at 9 AM
- HTTP Request - GET /campaigns/:id/stats
- Slack - Post summary to #sales channel
Get Campaign Stats
Method: GET
URL: https://api.mcpfactory.org/campaigns/{{ $json.campaign_id }}/stats
Response:
{
"campaign_id": "camp_abc123",
"status": "running",
"stats": {
"emails_sent": 247,
"delivered": 231,
"opened": 54,
"replied": 12,
"meetings_booked": 3
},
"costs": {
"total_byok_usd": 4.23
}
}Pause/Resume Campaigns
// Pause
POST https://api.mcpfactory.org/campaigns/{{ $json.campaign_id }}/pause
// Resume
POST https://api.mcpfactory.org/campaigns/{{ $json.campaign_id }}/resume