Instagram First Comment API
How to publish a post to Instagram and immediately add a first comment via API — the common pattern for hiding hashtags.
Instagram’s publish call has no built-in “also post this comment” field — a first comment is two separate API calls: publish the post, then POST /{ig-media-id}/comments with a message against the media ID the publish returned, gated by a separate comment-management permission. PostGate’s post.published webhook tells you exactly when the post is live and what its media ID is.
Publishing a caption and immediately adding a first comment — usually to hide a hashtag block, add a link, or credit a collaborator without cluttering the caption — is a common pattern, but it is worth being clear about what actually exists to support it: Instagram's publish call has no built-in "also post this comment" field. It is two separate API calls, in a specific order, against two different object IDs.
Why is this two calls, not one?
A comment attaches to a published media object's ID — an ID that does not exist until media_publish returns it. There is no field on the container-creation or publish call that accepts comment text; the comment has to be created afterward, against the media ID the publish call just handed you, using Instagram's comment endpoint.
What does the native second call look like?
Natively, once you have the published media ID, the comment call is POST /{ig-media-id}/comments with a message parameter, gated by a comment-management permission distinct from the publishing permission itself — see what the publishing permission does and does not cover.
POST /{ig-media-id}/comments
?message=👉 Link in bio. #launch #productlaunch
&access_token={access-token}What trigger does a first-comment pattern actually need?
The hard part is not the comment call itself — it's knowing precisely when the post is live and what its media ID is, since firing the comment call too early fails outright. PostGate gives you that moment as a post.published webhook, with the platform post ID and permalink attached to the specific Instagram target — the same identifying evidence Instagram's own media_publish response returns, delivered as a structured event instead of something you have to poll for.
What does PostGate’s comment API support today?
PostGate's comments API currently covers listing comments on a published target and replying to an existing comment thread — it does not yet expose a single field on POST /api/posts that creates a fresh top-level comment the moment a target publishes. Until it does, the pattern above — react to the post.published webhook, then call Instagram's comment endpoint directly with the target's platform post ID — is the honest way to build this today.
What about ordering and retries?
Treat the comment call as its own idempotent operation, separate from the post itself — retrying a comment call after a timeout with no deduplication can leave two identical first comments on the same post. Track whether you already succeeded before retrying, the same way PostGate's Idempotency-Key protects the publish call itself.
Frequently asked questions
Why can’t I post an Instagram comment in the same call as the post?
A comment attaches to a published media object’s ID — an ID that does not exist until media_publish returns it. There is no field on the container-creation or publish call that accepts comment text; the comment has to be created afterward, against the media ID the publish call just handed you, using Instagram’s comment endpoint.
What permission does the Instagram comment call need?
A comment-management permission distinct from the publishing permission itself — holding the publishing permission alone does not cover creating comments.
How do I know when to fire the first-comment call?
The hard part is knowing precisely when the post is live and what its media ID is, since firing the comment call too early fails outright. PostGate delivers that moment as a post.published webhook, with the platform post ID and permalink attached to the specific Instagram target — a structured event instead of something you have to poll for.
Does PostGate create the first comment automatically?
Not yet. PostGate’s comments API currently covers listing comments on a published target and replying to an existing comment thread — it does not yet expose a field on POST /api/posts that creates a fresh top-level comment the moment a target publishes. Until it does, react to the post.published webhook and call Instagram’s comment endpoint directly with the target’s platform post ID.
Can retrying the comment call create duplicate comments?
Yes — retrying a comment call after a timeout with no deduplication can leave two identical first comments on the same post. Treat the comment call as its own idempotent operation and track whether you already succeeded before retrying, the same way an Idempotency-Key protects the publish call itself.
