Documentation
How the system works, step by step: connect a channel, receive events on your webhook, verify them and reply through the API.
Describes the system as it works today.
How it works
The service sits between Meta (Instagram and Facebook Messenger) and your bot. You connect an account once; from then on every incoming message or comment is stored and sent to your webhook as signed JSON. Your bot answers by calling the send API.
- Someone writes to your Instagram account or Facebook page.
- We receive it from Meta, store it.
- We send it to your webhook: an HTTPS
POSTwith a JSON body and a signature. - Your bot (n8n, Make, Zapier, your own server) decides what to answer.
- Your bot calls
POST /api/v1/messagesand we deliver the reply to Meta.
You do not need your own Meta app or an app review: the connection uses Facebook Login with permissions that are already approved.
Quick start
- Create an account at /panel/login and choose a plan (the connection needs an active plan).
- Connect a channel. In Connections choose Connect channel, pick Instagram or a Facebook page and sign in with Meta. The connection appears in the list.
- Set your webhook. Open Configure webhook, paste an HTTPS URL and press Save. Optionally generate a signing secret.
- Send a test event. Press Send test event. Your URL receives a signed sample and you see the HTTP status and time.
- Receive real messages. Write to the connected account from another account. The event reaches your webhook within seconds and shows up in Inbox and Logs.
- Reply. Create an API key in Settings → API keys and call the send API with the
conversation.idfrom the event.
Channels and connections
- Instagram (professional or creator accounts): direct messages and comments. Comments can be answered publicly or privately.
- Facebook Messenger (Facebook pages): direct messages.
- WhatsApp: coming in a later phase.
Each plan allows a number of active connections (Basic 1, Pro 3, Agency 10). If you connect more accounts than your plan allows, the extra account is not kept. Disconnecting a channel stops new events but keeps the history in your Inbox and Logs.
Webhook setup
Every connection has its own webhook. In Connections → Configure webhook you can set:
- Webhook URL: must be HTTPS and publicly reachable. Local, private and internal addresses are rejected.
- On/off switch: pause forwarding without losing the URL. Events that arrive while it is off are stored but not sent.
- Signing secret (
whsec_…): generate it once and keep it; it is shown a single time. Regenerating it replaces the old one. - Custom headers: up to 5 headers sent with every request (for example
Authorization: Bearer …if your bot requires it). Values are stored encrypted and are never shown again. Names such asHost,Content-Typeandmeediar-*are reserved. - Send test event: delivers a sample
message.received(with"test": true) signed exactly like a real one. It is not counted in your usage.
Events
Every delivery is an HTTPS POST with Content-Type: application/json. The type field tells you what happened.
message.received
{
"type": "message.received",
"tenant": { "id": "b1c2…" },
"page": { "id": "3f7a…", "channel": "instagram", "name": "Casa Lucuma", "username": "@casalucuma" },
"conversation": { "id": "9d41…", "contactId": "17841…" },
"message": {
"id": "c0de…",
"direction": "inbound",
"status": "received",
"text": "Hi, do you have a table for tomorrow?",
"attachment": null,
"createdAt": "2026-11-05T15:04:11Z"
}
}
conversation.id is what you pass to the send API to reply. attachment is null or an object with the media type and url.
comment.received
{
"type": "comment.received",
"tenant": { "id": "b1c2…" },
"page": { "id": "3f7a…", "channel": "instagram", "name": "Casa Lucuma", "username": "@casalucuma" },
"comment": {
"id": "1790…",
"postId": "6a91…",
"platformPostId": "1784…",
"text": "How much is it?",
"author": { "id": "1784…", "username": "marta", "name": "Marta" },
"createdAt": "2026-11-05T15:06:40Z"
}
}
Comments from your own account are not forwarded. Use page.id as connectionId, and postId and comment.id in the comment replies.
Verifying the signature
Every request carries three headers:
| Header | Meaning |
|---|---|
meediar-event-id | Unique id of the event. Identical on every retry, so use it to deduplicate. |
meediar-timestamp | Unix time in seconds when the request was signed. |
meediar-signature | v1= followed by the hex HMAC-SHA256 of {event-id}.{timestamp}.{raw body} with your signing secret. Only sent if you generated a secret. |
Compute the HMAC over the raw body exactly as received (before any JSON parsing), compare in constant time and reject requests whose timestamp differs from your clock by more than 300 seconds.
Node.js
import { createHmac, timingSafeEqual } from 'node:crypto';
export function verify(headers, rawBody, secret) {
const id = headers['meediar-event-id'];
const ts = headers['meediar-timestamp'];
if (Math.abs(Date.now() / 1000 - Number(ts)) > 300) return false;
const expected = 'v1=' + createHmac('sha256', secret).update(`${id}.${ts}.${rawBody}`).digest('hex');
const received = headers['meediar-signature'] ?? '';
return expected.length === received.length && timingSafeEqual(Buffer.from(expected), Buffer.from(received));
}
Python
import hmac, hashlib, time
def verify(headers, raw_body: bytes, secret: str) -> bool:
event_id = headers["meediar-event-id"]
ts = headers["meediar-timestamp"]
if abs(time.time() - float(ts)) > 300:
return False
msg = f"{event_id}.{ts}.".encode() + raw_body
expected = "v1=" + hmac.new(secret.encode(), msg, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, headers.get("meediar-signature", ""))Delivery and retries
- Your server must answer with a 2xx status within 5 seconds. Process slow work after answering.
- If the request times out, fails to connect or returns
408,429or5xx, we retry after 5 s, 30 s, 2 min, 5 min and 15 min (up to 5 retries). - Other
4xxanswers are not retried: they mean your server rejected the event. - Redirects are not followed.
- Retries repeat the same
meediar-event-id. Deduplicate on it. - Each attempt appears in Logs as Successful, Retrying, Failed or Skipped (for example when there is no webhook, or no active plan).
Send API
Authenticate with an API key created in Settings → API keys. The secret is shown once; revoking a key takes effect immediately.
Authorization: Bearer pk_live_…
Base URL: https://meediar.com/api/v1. Requests and responses are JSON. Add an Idempotency-Key header to make retries safe: repeating the same key returns the original result with "idempotentReplay": true and nothing is sent twice.
POST /messages — reply in a conversation
curl -X POST https://meediar.com/api/v1/messages \
-H "Authorization: Bearer pk_live_..." \
-H "Idempotency-Key: 7f3a91c2" \
-H "Content-Type: application/json" \
-d '{"conversationId":"9d41…","text":"Yes! 8 pm works."}'
# 200
{ "message": { "id": "a1b2…" }, "meediar": { "status": "sent", "idempotentReplay": false } }
| Field | Required | What to send |
|---|---|---|
conversationId | Yes | The conversation.id of the event you are answering (a UUID). In n8n: {{ $json.body.conversation.id }}. |
text | Yes | The message to send, up to 2000 characters. |
Only these two fields are read. Other names (for example pageId, recipientId or reply) are ignored, and if conversationId or text is missing the API answers 400 with conversationId and text are required. Meta only accepts replies within 24 hours of the customer's last message.
POST /comments/private-reply — answer a comment by direct message
curl -X POST https://meediar.com/api/v1/comments/private-reply \
-H "Authorization: Bearer pk_live_..." \
-H "Content-Type: application/json" \
-d '{"connectionId":"3f7a…","postId":"6a91…","commentId":"1790…","text":"Thanks! Sent you the details."}'
A private reply can be sent once per comment, within 7 days. A second attempt returns 409.
POST /comments/reply — public reply to a comment
curl -X POST https://meediar.com/api/v1/comments/reply \
-H "Authorization: Bearer pk_live_..." \
-H "Content-Type: application/json" \
-d '{"connectionId":"3f7a…","postId":"6a91…","commentId":"1790…","text":"Check your DMs!"}'Schedule and publish posts
The same API key schedules posts on your connected Instagram, Facebook and YouTube accounts. Send JSON with already-hosted media (https URLs) or multipart/form-data with the files in file.
| Call | What it does |
|---|---|
POST /posts | Schedule a post. Fields: connectionId (page.id from the webhook), kind (post, reel, story; YouTube: video), content, title (required for YouTube), mediaItems ([{"type":"image"|"video","url":"https://…"}]), scheduledFor (ISO date) or publishNow: true. |
GET /posts?from=YYYY-MM-DD&to=YYYY-MM-DD | List posts with their status: scheduled, published, failed or cancelled. |
DELETE /posts/:id | Cancel a scheduled post. |
POST /posts/:id/retry | Send a failed post again. |
Events: post.published and post.failed
When a scheduled post is published or fails, your connection's webhook receives a signed event with type post.published or post.failed, the page and a post object (id, channel, kind, content, mediaUrls, scheduledFor, status, error and, when available, url). It is delivered and retried like any other event.
Quick start: schedule a post in three calls
- Get the
connectionId: it is thepage.idof any event, or the connection id shown in your panel. - Schedule it. Send
scheduledForin ISO 8601 (orpublishNow: true). - Read the status with
GET /posts, or wait for thepost.publishedevent.
curl -X POST https://meediar.com/api/v1/posts \
-H "Authorization: Bearer pk_live_..." \
-H "Content-Type: application/json" \
-d '{"connectionId":"PAGE_ID","kind":"post","content":"New menu today","mediaItems":[{"type":"image","url":"https://example.com/menu.jpg"}],"scheduledFor":"2026-12-01T15:00:00Z"}'
The full machine-readable reference is in the OpenAPI 3.1 specification, and llms.txt summarizes Meediar for AI assistants.
Reply from n8n, Make or your code
A typical bot: your automation tool receives the event, decides the answer (fixed text, an AI node, a database lookup) and replies through the API. In n8n three nodes are enough.
- Webhook node. Method
POST. Copy its Production URL into Connections → Configure webhook. Set Respond to Immediately: we wait only 5 seconds, so answer200first and reply afterwards. The event body is in$json.bodyand the headers in$json.headers. - IF node (recommended). Continue only when
{{ $json.body.type }}equalsmessage.receivedand{{ $json.body.test }}is nottrue. Test events carry sample data and must not be answered. - Your logic. An AI Agent, an OpenAI node, a Set node with a fixed text… Its output is the text you will send.
- HTTP Request node to the send API, configured as below. Store the key as a Header Auth credential instead of typing it in the node.
Node: HTTP Request
Method POST
URL https://meediar.com/api/v1/messages
Headers Authorization = Bearer pk_live_...
Idempotency-Key = {{ $('Webhook').item.json.headers['meediar-event-id'] }}
Body (JSON, "Using Fields Below")
conversationId = {{ $('Webhook').item.json.body.conversation.id }}
text = {{ $json.output }}
Using the event id as Idempotency-Key makes the flow safe: if our delivery is retried or n8n runs the node twice, the customer still receives one reply.
Answer a comment by direct message
For a comment.received event call POST /comments/private-reply with these fields:
connectionId = {{ $('Webhook').item.json.body.page.id }}
postId = {{ $('Webhook').item.json.body.comment.postId }}
commentId = {{ $('Webhook').item.json.body.comment.id }}
text = Thanks! I sent you a DM.
Authenticating the webhook in n8n
Checking the signature in n8n needs the raw body (enable the Webhook node's Raw Body option) and the crypto module allowed in Code nodes. A simpler option: add a custom header to the connection (for example Authorization: Bearer your-long-random-token) and set the Webhook node's Authentication to Header Auth with the same value.
Make and Zapier
The same three pieces apply: a Custom webhook (Make) or Catch Hook (Zapier) receives the event; an HTTP → Make a request module (Make) or Webhooks by Zapier → Custom Request (Zapier) calls POST https://meediar.com/api/v1/messages with the same headers and JSON body.
From your own server (Node.js)
const event = JSON.parse(rawBody);
if (event.type === 'message.received' && !event.test) {
await fetch('https://meediar.com/api/v1/messages', {
method: 'POST',
headers: {
Authorization: 'Bearer ' + process.env.MEEDIAR_KEY,
'Idempotency-Key': req.headers['meediar-event-id'],
'Content-Type': 'application/json',
},
body: JSON.stringify({ conversationId: event.conversation.id, text: 'Hello! How can I help?' }),
});
}Errors
Errors are JSON: { "error": "message" }, sometimes with a code.
| Status | Meaning |
|---|---|
400 | Missing or invalid fields (for example conversationId and text are required). |
401 | Missing, invalid or revoked API key. |
402 | No active plan (no_plan). |
403 | Account suspended. |
404 | Conversation or connection not found. |
409 | A private reply was already sent to that comment. |
422 | Meta rejected the message (for example the 24-hour window has passed). |
429 | Too many requests (limit: 120 per minute per account). Honour Retry-After. |
502 | Meta could not be reached. Retry with the same Idempotency-Key. |
Limits
| Item | Limit |
|---|---|
| Webhook response time | 5 seconds |
| Delivery retries | 5 (5 s, 30 s, 2 min, 5 min, 15 min) |
| Custom headers per connection | 5 |
| Reply text | 2000 characters |
| Reply window | 24 hours after the customer's last message |
| Private reply to a comment | Once, within 7 days |
| API requests | 120 per minute per account |
| API keys | 20 active keys |
| Signature tolerance | 300 seconds |
Plans and usage
| Plan | Connections | Messages and contacts | Price |
|---|---|---|---|
| Basic | 2 | Unlimited | $15 / 30 days |
| Pro | 4 | Unlimited | $29 / 30 days |
| Agency | 12 | Unlimited | $79 / 30 days |
You pay for connections, not for messages or contacts. Your panel shows how many messages went through each month, for your information; there is no cap and nothing is blocked when the number grows.
Fair use. If a connection sends more than 100,000 messages in a month, or its use harms the service or breaks Meta's policies, we will contact you before doing anything. Meta's own limits, such as the 24-hour reply window, always apply.
When a plan expires, forwarding and sending pause until you renew; stored messages are kept.
The panel
- Connections: connect and disconnect channels, webhook, secret, headers and test event.
- Inbox: read-only view of conversations and the replies your bot sent. Replies are always sent through the API.
- Logs: every webhook received from Meta, every delivery to your bot and every call to the API, with status, HTTP code and duration. Filter by period, status, direction, platform, connection and HTTP code.
- Settings: account, password, API keys and subscription. You can delete your account and all its data at any time.