Direct Message (DM) Automation
Automate one-on-one responses, handle media attachments in DMs, send product cards, and deploy structured quick reply buttons to guide conversations.
Enterprise software, built and audited in India.
Connect your business account to the Instagram Graph API. Automate responses to customer DMs, moderate comments in real time, fetch mention objects, publish visual assets programmatically, and track rich analytics metrics.
Instagram API Gateway
● Operational (v20.0)POST /v20.0/me/messages HTTP/1.1Host: graph.facebook.comAuthorization: Bearer EAAXX...Content-Type: application/json// Request Payload{ "recipient": { "id": "USER_IG_SCOPE_ID" } "message": { "text": "Hello! Thanks for reaching out to us on Instagram. How can we help?" }}
Capabilities
Automate one-on-one responses, handle media attachments in DMs, send product cards, and deploy structured quick reply buttons to guide conversations.
Publish single images, carousels, Reels, and Stories directly to your profile page, with options to schedule captions, locations, and user tags.
Retrieve comments on your posts in real-time, filter inappropriate strings programmatically, publish replies, and hide or delete comments instantly.
Track metrics such as reach, impressions, profile views, follower demographics, video views, Reel play statistics, and aggregate engagement rates.
Platform architecture
The Official Instagram Graph API enables software systems to connect programmatically with Instagram Professional (Business and Creator) accounts. Designed to solve high-frequency engagement problems, this API allows developers to publish images, video posts, Reels, and Stories to accounts; manage comments, replies, and photo tags; extract analytical data about media and profile performance; and handle direct customer conversations through the Instagram Messaging platform.
Integrating with Instagram has evolved from simple post scheduling to building complete conversation funnels. By routing user actions, direct messages, comment updates, and mentions through Meta's secure cloud infrastructure, businesses can build unified communication desks, run real-time automated bot workflows, support customer transactions, and compile detailed engagement metrics.
Because the API is part of Meta's Graph API, it utilizes standard authentication schemes and security mechanisms. The underlying data model connects Instagram business accounts directly to Facebook pages, ensuring that permissions and roles are centralized under Facebook Business Manager. This allows secure, fine-grained access delegate configurations suitable for enterprise compliance.
API reference
The API operates via standard HTTPS requests using JSON structures. Below are the key endpoints and request details for sending messages and automating responses.
POST https://graph.facebook.com/v20.0/YOUR_PAGE_ID/messages Header "Authorization: Bearer YOUR_ACCESS_TOKEN" Header "Content-Type: application/json"
{
"recipient": {
"id": "7891234560"
},
"messaging_type": "RESPONSE",
"message": {
"text": "Hi! We've processed your request. Click the link to view your custom dashboard.",
"attachment": {
"type": "template",
"payload": {
"template_type": "generic",
"elements": [
{
"title": "Welcome Pack",
"image_url": "https://devsecit.com/assets/welcome.png",
"subtitle": "Click below to review details",
"buttons": [
{
"type": "web_url",
"url": "https://dwa.devsecit.com",
"title": "Open Portal"
}
]
}
]
}
}
}
}{
"recipient_id": "7891234560",
"message_id": "m_1029384756qwe123"
}Webhooks
To achieve bidirectional messaging and real-time support, you must configure a Webhook endpoint. Instagram sends webhook payloads when users comment on posts, mention your profile, or send direct messages.
Below is a JSON schema depicting an incoming direct text message event sent to your configured Webhook callback URL:
{
"object": "instagram",
"entry": [
{
"id": "182736452098",
"time": 1724018290,
"messaging": [
{
"sender": { "id": "9012345678" },
"recipient": { "id": "8912345670" },
"timestamp": 1724018288,
"message": {
"mid": "aWdfbWVzc2FnZV9pZDEyMzQ1",
"text": "Send me the white label price plans."
}
}
]
}
]
}API Documentation
Official Instagram Graph API
Security
Connecting to Meta's ecosystem requires passing security protocols and setting explicit permission scopes during OAuth token acquisition. Ensure the following items are properly configured:
System access tokens must have permission scopes: `instagram_basic`, `instagram_manage_messages`, `instagram_manage_comments`, and `pages_read_engagement`.
Use Facebook's System User token endpoint to exchange short-lived tokens (2-hour limit) for long-lived system tokens that remain valid indefinitely until manually revoked.
Validate the signature payload using the app's Client Secret by computing the HMAC-SHA256 signature of the raw request payload to ensure no man-in-the-middle tempering occurs.
To transition your application from Development status to Production status, submit your application for Meta App Review, demonstrating clear workflows for the scopes requested.
Enterprise use cases
Integrate dynamic story links. When users swipe up or interact with custom stickers, trigger personalized Instagram DMs containing lead forms, qualifying questions, and direct download links.
Run comment triggers. When users comment on a product post (e.g., 'price' or 'info'), parse the comment webhook instantly and dispatch a structured DM offering order details, checkout links, and coupon codes.
Sync all incoming Instagram direct messages, media elements, story mentions, and replies to central ticketing software, ensuring seamless agent routing and SLA tracking.
The numbers
Latency, payload ceilings and publishing limits as published for the Instagram Graph API.
Gateway latency on the v20.0 messaging endpoint.
Images and video respectively.
Posts, Reels and Stories combined in any rolling window.
Exchange for long-lived system tokens via the System User endpoint.
Questions
No. The Instagram Graph API requires your account to be upgraded to either a Professional Business Account or a Creator Account, and it must be linked directly to a verified Facebook Page.
Verify that the setting for "Allow Access to Messages" is enabled inside your Instagram Account's Privacy Settings, under the Message Control section. Also, ensure the page access token has correct permissions.
Under standard Meta API rates, Instagram Professional accounts are capped at a publishing limit of 150 posts, Reels, or Stories combined within any rolling 24-hour window.
The webhook notification will contain a URL to the media attachment. Your backend must download and cache this asset promptly, as the links expire after a short duration for security reasons.
Get started
Schedule visual posts, build automated DM reply flows, and aggregate dashboard insights using DEV SEC IT integration wrappers.