# Webhooks + n8n: Agent Triggers for Social Media Automation

**TL;DR:** Use ViralNote **webhooks** (`post.published`, `post.failed`, etc.) to trigger n8n (or Make/Zapier) flows instead of polling. Create subscriptions via MCP `create_webhook`, REST API, or dashboard. Pair with agents for “react when something happens” automations.

Event-driven automation beats asking an agent to poll every 30 minutes. When a post publishes or fails, ViralNote pushes a JSON payload to your URL — n8n handles Slack alerts, retries, CRM updates, or a follow-up agent run.

## Events you can subscribe to

Common webhook events (see [API docs](https://www.viralnote.app/developers/docs) for full list):

- `post.published` — all targeted platforms succeeded
- `post.failed` — at least one platform failed
- `post.scheduled` — post entered scheduled queue
- `media.imported` — new library item ready

Payload includes `post` id, platforms, timestamps, and per-platform results where applicable.

## Create a webhook (MCP)

With ViralNote MCP connected:

> Create a webhook pointing to `https://your-n8n.example.com/webhook/viralnote-posts` for events `post.published` and `post.failed`.

Tool: `create_webhook` with `url` and `events` array.

**REST equivalent:**

```bash
curl -X POST https://dashboard.viralnote.app/api/v1/webhooks \
  -H "x-api-key: $VIRALNOTE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://your-n8n.example.com/webhook/viralnote-posts",
    "events": ["post.published", "post.failed"]
  }'
```

Store the signing secret if returned — verify signatures in n8n (custom Function node or crypto).

## n8n workflow sketch

**Trigger:** Webhook node (POST) at `/webhook/viralnote-posts`

**Branch A — `post.failed`:**

1. Parse JSON body
2. Slack / email: “Publish failed on {{platform}}: {{error}}”
3. Optional: HTTP Request to agent API with “draft recovery steps”

**Branch B — `post.published`:**

1. Log to Google Sheet or Notion
2. If impressions tracking elsewhere, enqueue analytics pull in 24h (second workflow with cron + `list_analytics`)

**Branch C — fan-out to agent:**

1. POST to your OpenClaw/Hermes webhook endpoint with event summary
2. Agent decides follow-up (quote tweet, LinkedIn comment) — **with human approval gate**

## MCP + n8n together

| Layer | Role |
|-------|------|
| **MCP agent** | Plans and creates schedules in chat |
| **n8n** | Reacts to publish/fail events reliably |
| **REST** | n8n HTTP nodes call `/api/v1/*` when needed |

Don’t make the LLM poll — webhooks are the production path.

## Agent workflow 3 upgrade

Replace the polling monitor in [three agent workflows](/blog/three-agent-workflows-social-media-scheduling) with:

1. `create_webhook` once
2. n8n receives events
3. Agent invoked only on failure or milestone (cheaper, faster)

## Security checklist

- HTTPS webhook URLs only
- Verify webhook signatures if enabled
- Separate API keys: one for n8n (webhook management + read), one for interactive agents
- Don’t expose n8n webhooks without auth on public internet

## No-code alternative

See [build a social media agent without code](/blog/build-social-media-agent-without-code) for Zapier/Make triggers without n8n.

## Links

- [MCP tool reference](https://www.viralnote.app/developers/mcp)
- [OpenAPI spec](https://www.viralnote.app/api/v1/openapi)
- [Agent workflows](/blog/three-agent-workflows-social-media-scheduling)

Push events, don’t pull — your automations get faster and your agent bill gets smaller.

## FAQ

**Does ViralNote support webhooks?**

Yes. Subscribe to events like post.published and post.failed via create_webhook (MCP), REST API, or dashboard. Payloads include post ids and per-platform results.

**How do I connect ViralNote to n8n?**

Create a webhook in ViralNote pointing to an n8n Webhook trigger URL. Branch on event type for Slack alerts, sheet logging, or agent follow-ups.

**Webhooks vs agent polling for publish status?**

Webhooks are more reliable and cheaper — the agent runs only when something happens. Use polling only for prototypes.


---

Site index for agents: https://www.viralnote.app/llms.txt · Structured view: https://www.viralnote.app/agent.json · API: https://www.viralnote.app/openapi.json · Auth: https://www.viralnote.app/auth.md
