Instagram· 5 min read

Instagram DMs by API: the 24-hour window and human agent tag


Your app can message an Instagram user only after that user writes to your professional account, and only inside the standard messaging window that their message opens. Meta’s guide says: “For most user actions, it lasts 24 hours” (Instagram API with Instagram Login, Send Messages). After that, a person on your team can still reply for up to 7 days with the HUMAN_AGENT tag. Your app needs the Human Agent permission, granted through App Review, before Meta accepts the tag. Automated replies may not use it.

Two APIs reach the same inbox

Meta documents two ways to send Instagram DMs, and the names, hosts and permissions differ. The Messenger Platform guide sends accounts linked to a Page to the Instagram Messaging API. Accounts without a Page use the Instagram API with Instagram Login (Messenger send a message).

Instagram API with Instagram Login Instagram Messaging API (linked Page)
Host and path graph.instagram.com/<IG_ID>/messages graph.facebook.com/<PAGE_ID>/messages
Token Instagram User access token Page access token
Messaging permissions instagram_business_basic, instagram_business_manage_messages instagram_basic, instagram_manage_messages, pages_manage_metadata
Webhook fields messages, messaging_optins, messaging_postbacks, messaging_reactions, messaging_referrals, messaging_seen messages, message_reactions, messaging_postbacks, messaging_seen, messaging_referral, standby

Sources for the right column are the Instagram Messaging overview, send a message and webhooks pages. Compare the webhook rows. The reaction and referral field names differ by one word or one letter, so code written for one API silently drops events from the other.

The recipient is the same on both. It’s the IGSID, the Instagram-scoped ID that arrives in the messaging webhook for the person who wrote to you. A text message must be UTF-8 and 1,000 bytes or less.

Who you can message

“Only after an Instagram user has sent your app user’s Instagram professional account a message can your app send a message to the Instagram user” (Send Messages).

Access level adds a second limit. Meta’s send guide says: “Apps with Standard Access can only send messages to people that have a role on the app” (send a message). Serving professional accounts you don’t own or manage needs Advanced Access. For webhooks, Meta writes that “Your app must be published, regardless of app review status, to receive webhooks”. Data from people without a role on the app also needs App Review approval (webhooks).

Conversations from people who don’t follow the account land in the Requests folder. “Messages in the Requests folder that have not been active for 30 days will not be returned in API calls” (Send Messages).

The 24-hour standard messaging window

The window starts with the user’s message. For a first message that comes from a Click-to-Direct ad, “the window may last up to 7 days from that message” (same page). Meta’s policy states that “Messages sent within the standard messaging window may contain promotional content” (Messenger Platform and IG Messaging API policy).

None of these pages documents an endpoint that reports whether a window is open. Store the time of each inbound message per IGSID from the messages webhook and decide before every send. Skip events where the is_echo flag is present. Meta sets it when “the message is sent from the Instagram account itself” (webhooks), and an echo must never reset your clock.

SELECT
  CASE
    WHEN last_inbound_at > now() - interval '23 hours' THEN 'standard'
    WHEN last_inbound_at > now() - interval '7 days'   THEN 'human_agent_only'
    ELSE 'closed'
  END AS send_mode
FROM ig_contacts
WHERE igsid = 'IGSID';

The one-hour margin on the first branch covers queue delay. A closed result means you wait for the user to write again. Click-to-Direct conversations need their own column if you want to use the longer ad window.

The HUMAN_AGENT tag

The Messenger Send API reference describes the tag’s allowed use as human agent support for issues that cannot be resolved within the standard window. Its examples are issues outside business hours and issues that need more than 24 hours. A human agent can reply up to 7 days after the person’s message. Disallowed uses include automated messages and content unrelated to the user’s inquiry (Send API reference).

Instagram gets no other tag. The Page Messages reference says: “Only HUMAN_AGENT is available for Instagram Messaging” (Page Messages, v26.0). The account update, event update and post-purchase tags are Messenger-only, and Meta has retired them there too. Messenger message tags: sending outside the 24-hour window covers that list.

Permission comes before the first tagged send. The Send API reference says apps must enroll for the Human Agent permission in the App Dashboard. Only apps that have completed App Review can use it, and the submission has to demonstrate the intended use. Meta’s changelog of 2 June 2021 told developers to apply for the permission “even if your app has been previously approved for Human Agent message tag” (Messenger changelog).

On the linked-Page API, the documented parameters give the body below. Send it to POST /<PAGE_ID>/messages.

{
  "recipient": { "id": "IGSID" },
  "messaging_type": "MESSAGE_TAG",
  "tag": "HUMAN_AGENT",
  "message": { "text": "AGENT_REPLY_TEXT" }
}

The Instagram Login guide says your app “can tag the response to use the separate 7-day Human Agent window”, but it does not print the field names. Test the same tag and messaging_type fields against graph.instagram.com before you rely on them there.

Meta reviews the escalation path

The Instagram Messaging overview lists “an escalation path to a human agent” as a requirement for the app (overview). The escalation guide accepts a custom inbox or an automated experience. It asks you to “demonstrate that when escalation to a human agent happens, thread ownership transfers to the inbox” (Human Agent Escalation). The tool for that transfer is the Conversation Routing API.

In code, send the tag only from the path where a person typed the text. If a bot composes the reply, the tag is misuse. Meta’s warning is that use of tags “outside of approved use cases may result in restrictions on your ability to send messages” (policy). The bot-to-human handover pattern is in Hand a WhatsApp AI agent conversation to a human in Chatwoot, and the state model carries over to Instagram.

If you also answer on WhatsApp, Messenger or Telegram, Z-API Omni puts WhatsApp, Messenger, Instagram and Telegram in one subscription (View documentation).

Z-API Omni team