Instagram Messaging API: "This message is sent outside of allowed window"

I have a workflow that receives Instagram comments via webhook and sends a DM to the commenter using the Instagram Messaging API.

Endpoint: POST https://graph.instagram.com/v24.0/{page_id}/messages

The webhook and all previous nodes work fine, but the HTTP Request returns:

403 - IGApiException, code 10, error_subcode 2534022
"This message is sent outside of allowed window."

The token has instagram_manage_messages permission and works for other API calls. The commenter is not the page’s own account.

Has anyone successfully sent DMs in response to comments via the Instagram Graph API? Does the API require a prior DM conversation to exist before you can message someone?

  • n8n 2.6.4 (Self Hosted)

  • Instagram Graph API v24.0

Hi @felipestoker, welcome back to the community!
From waht I know, this error comes from Instagram’s 24 hour messaging window. A comment on a post does not open a DM window, so the regular messages endpoint will fail. To fix this, you need to use the private reply endpoint for comments, which works once per comment and within seven days, and make sure your token has the instagram_manage_comments permission. If you need to send more messages later, use that private reply to ask the user to DM the page, which then opens the 24 hour window.