लग इननिःशुल्क ट्रायल सुरु गर्नुहोस्
easyCoexistence आधिकारिक एपीआई

Python र Node.js मा Instagram API: काम गर्ने उदाहरणहरू

Instagram API ला HTTPS बाहेक केही पनि चाहिँदैन, त्यसैले Python को requests र Node.js को अन्तर्निर्मित fetch ले यसलाई पुग्छ: POST /<IG_ID>/media पछि media_publish ले प्रकाशित गर्छ, /<IG_MEDIA_ID>/comments र /<IG_COMMENT_ID>/replies ले कमेन्ट पढ्छन् र जवाफ दिन्छन्, /insights ले मेट्रिक फिर्ता गर्छ, र वेबहुकलाई मूल बडीको HMAC-SHA256 ले जाँच्छ। हरेक त्रुटिसँग code र subcode हुन्छ, जसले पुन: प्रयासले मद्दत गर्न सक्छ कि सक्दैन भन्ने निर्धारण गर्छ।

easyCoexistence ले उही कामहरू MCP उपकरणको रूपमा चलाउँछ, Claude, ChatGPT वा तपाईंको आफ्नै एजेन्टका लागि, टोकन आफ्नो तर्फ राखेर: publish_instagram_post, reply_to_comment, get_social_insights र set_social_webhook_destination, Meta को आधिकारिक एपीआई मा।

v26.0

नवीनतम Graph API संस्करण 2026 जुलाई 29 मा सुरु भयो; v25.0 2028 जुलाई 29 सम्म उपलब्ध रहन्छ।

Once a minute

भिडियो कन्टेनरको status_code Meta ले सुझाएको अन्तरालमा जाँचिन्छ, 5 मिनेटभन्दा बढी नभई।

50

एउटा GET /<IG_MEDIA_ID>/comments अनुरोधले फिर्ता दिन सक्ने अधिकतम कमेन्ट; जवाफहरू फिल्ड विस्तार गरेर मात्र आउँछन्।

2207008

अस्थायी प्रकाशन त्रुटि, जसका लागि Meta ले 30 सेकेन्ड देखि 2 मिनेटभित्र 1 देखि 2 पटक पुन: प्रयास गर्न सुझाउँछ।

sha256=

X-Hub-Signature-256 मा अगाडि आउने उपसर्ग, जसपछि एप सिक्रेटले कुञ्जी बनाएको पेलोडको HMAC-SHA256 आउँछ।

उदाहरणहरूलाई के चाहिन्छ?

एउटा रनटाइम, एउटा टोकन र चारवटा मान। उदाहरणहरूले Instagram Login मार्फत graph.instagram.com मा Instagram API कल गर्छन्; Unified Login एपले उही बाटो प्रयोग गर्छ, तर खाताको ID सहित, Facebook Login को Graph होस्टमा र उसको Business Integration System User टोकनसहित। Python लाई requests प्याकेज चाहिन्छ, र वेबहुकका लागि Flask; Node.js लाई आफ्नो अन्तर्निर्मित fetch का लागि संस्करण 18 वा माथिको चाहिन्छ।

  • GRAPH: https://graph.instagram.com/v26.0, होस्ट र एपीआई संस्करण।
  • IG_ID: पेशेवर खाताको ID, जुन GET /me ले फिर्ता दिने user_id हो।
  • TOKEN: दीर्घकालीन Instagram User एक्सेस टोकन, जुन सर्भरमा राखिन्छ।
  • APP_SECRET र VERIFY_TOKEN: वेबहुक अनुरोधहरू जाँच्नका लागि।

Python मा एपीआई कसरी कल गर्ने र त्रुटिहरू कसरी सम्हाल्ने?

एउटा सहायक प्रकार्यमार्फत, जुन Python का उदाहरणहरूले साझा गर्छन्। यसले टोकनलाई access_token को रूपमा पठाउँछ, Meta को code, subcode र fbtrace_id सहित MetaError उठाउँछ, र Meta ले अस्थायी भनेका त्रुटिहरूमा मात्र पुन: प्रयास गर्छ: कोड 1 र 2, थ्रोटलिङ कोड 4, 17 र 80002, र subcode 2207001, 2207003, 2207008 र 2207032। कोड 4 सँग subcode 2207051 भए त्यो स्प्यामको शंका हो, त्यसैले तुरुन्तै रोकिन्छ।

Python: the shared helper (requests)
import json
import time

import requests

GRAPH = "https://graph.instagram.com/v26.0"
IG_ID = "<IG_ID>"  # user_id from GET /me
TOKEN = "<TOKEN>"  # long-lived Instagram User access token, server side only

RETRY_CODES = {1, 2, 4, 17, 80002}
RETRY_SUBCODES = {2207001, 2207003, 2207008, 2207032}


class MetaError(Exception):
    def __init__(self, error: dict, status: int):
        super().__init__(error.get("message", f"HTTP {status}"))
        self.code = error.get("code")
        self.subcode = error.get("error_subcode")
        self.fbtrace_id = error.get("fbtrace_id")  # log it: Meta support asks for it

    @property
    def needs_new_token(self) -> bool:
        return self.code in (102, 190)

    @property
    def retryable(self) -> bool:
        if self.subcode == 2207051:  # code 4 with this subcode is suspected spam: stop
            return False
        return self.code in RETRY_CODES or self.subcode in RETRY_SUBCODES


def wait_seconds(resp) -> int:
    """estimated_time_to_regain_access from X-Business-Use-Case-Usage, at least 60 s."""
    try:
        usage = json.loads(resp.headers.get("X-Business-Use-Case-Usage", "{}"))
        minutes = max(e.get("estimated_time_to_regain_access", 0) for v in usage.values() for e in v)
    except (ValueError, AttributeError, TypeError):
        minutes = 0
    return max(60, int(minutes) * 60)


def graph(method: str, path: str, attempts: int = 3, **params) -> dict:
    if attempts < 1:
        raise ValueError("attempts must be at least 1")
    params["access_token"] = TOKEN
    for attempt in range(1, attempts + 1):
        resp = requests.request(method, f"{GRAPH}/{path}", params=params, timeout=30)
        try:
            data = resp.json()
        except ValueError:
            data = {}
        if resp.ok and "error" not in data:
            return data
        err = MetaError(data.get("error", {}), resp.status_code)
        if not err.retryable or attempt == attempts:
            raise err
        time.sleep(wait_seconds(resp))

Node.js मा एपीआई कसरी कल गर्ने र त्रुटिहरू कसरी सम्हाल्ने?

Node.js 18 वा माथिको संस्करणका लागि उही सहायकले, fetch प्रयोग गरेर र कुनै निर्भरता नराखी। थ्रोटल भएको कल estimated_time_to_regain_access बराबरको समय पर्खन्छ, जुन X-Business-Use-Case-Usage हेडरमा Meta ले रिपोर्ट गरेका मिनेट हुन्; हेडर नभए 60 सेकेन्ड पर्खिन्छ, किनकि Meta ले थ्रोटल हुँदा गरिएका कलहरूलाई पनि गन्छ। needsNewToken ले कोड 190 र 102 लाई चिन्ह लगाउँछ, जुन कुनै पुन: प्रयासले ठीक गर्न सक्दैन।

Node.js: the shared helper (fetch, ES module)
const GRAPH = "https://graph.instagram.com/v26.0";
const IG_ID = process.env.IG_ID; // user_id from GET /me
const TOKEN = process.env.TOKEN; // long-lived Instagram User access token, server side only

const RETRY_CODES = new Set([1, 2, 4, 17, 80002]);
const RETRY_SUBCODES = new Set([2207001, 2207003, 2207008, 2207032]);

export class MetaError extends Error {
  constructor(error, status) {
    super(error.message ?? `HTTP ${status}`);
    this.code = error.code;
    this.subcode = error.error_subcode;
    this.fbtraceId = error.fbtrace_id; // log it: Meta support asks for it
  }
  get needsNewToken() {
    return this.code === 190 || this.code === 102;
  }
  get retryable() {
    if (this.subcode === 2207051) return false; // code 4 with this subcode is suspected spam: stop
    return RETRY_CODES.has(this.code) || RETRY_SUBCODES.has(this.subcode);
  }
}

export const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));

// estimated_time_to_regain_access from X-Business-Use-Case-Usage, at least 60 s
function waitMs(res) {
  try {
    const usage = JSON.parse(res.headers.get("x-business-use-case-usage") ?? "{}");
    const minutes = Math.max(0, ...Object.values(usage).flat().map((e) => e.estimated_time_to_regain_access ?? 0));
    return Math.max(60, minutes * 60) * 1000;
  } catch {
    return 60_000;
  }
}

export async function graph(method, path, params = {}, attempts = 3) {
  const url = new URL(`${GRAPH}/${path}`);
  for (const [key, value] of Object.entries({ ...params, access_token: TOKEN })) {
    url.searchParams.set(key, String(value));
  }
  for (let attempt = 1; attempt <= attempts; attempt++) {
    const res = await fetch(url, { method });
    const data = await res.json().catch(() => ({}));
    if (res.ok && !data.error) return data;
    const err = new MetaError(data.error ?? {}, res.status);
    if (!err.retryable || attempt === attempts) throw err;
    await sleep(waitMs(res));
  }
  throw new Error("attempts must be at least 1");
}

Python मा फोटो र Reel कसरी प्रकाशित गर्ने?

दुवै कन्टेनर प्रवाह पछ्याउँछन्। फोटो कन्टेनर तुरुन्तै तयार हुन्छ, त्यसैले media_publish त्यसपछि सीधै आउँछ। Reel को भिडियो पहिले प्रशोधन हुन्छ: प्रकार्यले Meta को सुझाव अनुसार status_code लाई हरेक मिनेट जाँच्छ, 5 मिनेटसम्म, र FINISHED मा प्रकाशित गर्छ, ERROR वा EXPIRED मा रोक्छ। छविहरू JPEG हुनुपर्छ, र मिडिया सार्वजनिक यूआरएल मा हुनुपर्छ।

Python: a photo and a Reel
# Uses graph(), IG_ID and time from the helper above
def publish_photo(image_url: str, caption: str) -> str:
    """A JPEG at a public URL: create the container, then publish it."""
    container = graph("POST", f"{IG_ID}/media", image_url=image_url, caption=caption)
    return graph("POST", f"{IG_ID}/media_publish", creation_id=container["id"])["id"]


def publish_reel(video_url: str, caption: str) -> str:
    """A Reel: publish once Meta has processed the video, checking once a minute."""
    cid = graph("POST", f"{IG_ID}/media", media_type="REELS", video_url=video_url, caption=caption)["id"]
    for _ in range(5):  # Meta: once a minute, for no more than 5 minutes
        time.sleep(60)
        status = graph("GET", cid, fields="status_code")["status_code"]
        if status == "FINISHED":
            return graph("POST", f"{IG_ID}/media_publish", creation_id=cid)["id"]
        if status in ("ERROR", "EXPIRED"):
            raise RuntimeError(f"Container {cid} ended as {status}")
    raise TimeoutError(f"Container {cid} is still processing: check it again later")

Node.js मा फोटो र Reel कसरी प्रकाशित गर्ने?

उही दुई प्रकार्य, प्रत्येकले नयाँ मिडिया ID फिर्ता दिन्छ। पाँच जाँचपछि पनि IN_PROGRESS मा रहेको कन्टेनर यसको सिर्जनापछि 24 घण्टासम्म मान्य रहन्छ, त्यसैले त्रुटिले पछि फेरि जाँच्न भन्छ, जसले खाताको दैनिक 400 को सीमामा दोस्रो कन्टेनर बनाउनबाट बचाउँछ।

Node.js: a photo and a Reel
// Uses graph(), sleep() and IG_ID from the helper above
export async function publishPhoto(imageUrl, caption) {
  const { id } = await graph("POST", `${IG_ID}/media`, { image_url: imageUrl, caption });
  return (await graph("POST", `${IG_ID}/media_publish`, { creation_id: id })).id;
}

export async function publishReel(videoUrl, caption) {
  const { id } = await graph("POST", `${IG_ID}/media`, { media_type: "REELS", video_url: videoUrl, caption });
  for (let check = 0; check < 5; check++) {
    await sleep(60_000); // Meta: once a minute, for no more than 5 minutes
    const { status_code: status } = await graph("GET", id, { fields: "status_code" });
    if (status === "FINISHED") return (await graph("POST", `${IG_ID}/media_publish`, { creation_id: id })).id;
    if (status === "ERROR" || status === "EXPIRED") throw new Error(`Container ${id} ended as ${status}`);
  }
  throw new Error(`Container ${id} is still processing: check it again later`);
}

Python मा कमेन्ट कसरी पढ्ने र जवाफ कसरी दिने?

GET /<IG_MEDIA_ID>/comments ले सबैभन्दा नयाँदेखि सुरु हुने शीर्ष-स्तरका कमेन्ट फिर्ता दिन्छ, प्रति अनुरोध 50 सम्म; र POST /<IG_COMMENT_ID>/replies ले एउटालाई सार्वजनिक जवाफ पठाउँछ। प्रकार्यले प्रत्येक जवाफको पाठका लागि तपाईंको कलब्याक सोध्छ, र जसको लागि केही फर्काइँदैन त्यस्ता कमेन्ट छोड्छ। लुकाइएका कमेन्टमा जवाफ दिन सकिँदैन, र जवाफको जवाफ शीर्ष-स्तरको कमेन्टमा पुग्छ।

Python: read comments and reply
# Uses graph() from the helper above
def reply_to_comments(media_id: str, write_reply) -> int:
    """Reply in public to each comment write_reply returns text for."""
    page = graph("GET", f"{media_id}/comments", fields="id,text,username,timestamp")
    sent = 0
    for comment in page.get("data", []):
        text = write_reply(comment)
        if text:
            graph("POST", f"{comment['id']}/replies", message=text)
            sent += 1
    return sent


# Example: reply to questions about price
reply_to_comments("<IG_MEDIA_ID>", lambda c: "Prices are in our bio link." if "price" in c["text"].lower() else None)

Node.js मा कमेन्ट कसरी पढ्ने र जवाफ कसरी दिने?

Node.js मा उही लूप। दुवै कलले instagram_business_basic र instagram_business_manage_comments चाहिन्छन्, र username फिल्डलाई दोस्रो चाहिन्छ। बरु निजी रूपमा जवाफ दिन, POST /<IG_ID>/messages मा recipient.comment_id पठाउनुहोस्; यसले कमेन्ट गर्नेलाई एउटा DM पठाउँछ, कमेन्टको 7 दिनभित्र, र फलोअप तिनीहरूले जवाफ नदिउन्जेल पर्खिन्छ।

Node.js: read comments and reply
// Uses graph() from the helper above
// Reply in public to each comment writeReply returns text for
export async function replyToComments(mediaId, writeReply) {
  const { data = [] } = await graph("GET", `${mediaId}/comments`, { fields: "id,text,username,timestamp" });
  let sent = 0;
  for (const comment of data) {
    const text = writeReply(comment);
    if (text) {
      await graph("POST", `${comment.id}/replies`, { message: text });
      sent++;
    }
  }
  return sent;
}

// Example: reply to questions about price
await replyToComments("<IG_MEDIA_ID>", (c) => (/price/i.test(c.text) ? "Prices are in our bio link." : null));

Python मा इनसाइट्स कसरी पढ्ने?

खाता इनसाइट्समा period=day र metric_type=total_value पठाइन्छ, र प्रत्येक मेट्रिकले total_value.value रिपोर्ट गर्छ; पोस्टका इनसाइट्सले values[0].value रिपोर्ट गर्छन्। उदाहरणले खातामा reach, views र accounts_engaged, र पोस्ट वा Reel मा reach, views, likes, comments, saved र shares माग्छ, जुन Meta को सन्दर्भ दुवैका लागि सूचीबद्ध गर्छ। डेटा नभएको मेट्रिक 0 को रूपमा फिर्ता नगरी छोडिन्छ।

Python: account and post insights
# Uses graph() and IG_ID from the helper above
def account_insights() -> dict:
    """Reach, views and accounts engaged over the last 24 hours."""
    data = graph("GET", f"{IG_ID}/insights", metric="reach,views,accounts_engaged",
                 period="day", metric_type="total_value")["data"]
    return {m["name"]: m["total_value"]["value"] for m in data}


def post_insights(media_id: str) -> dict:
    """Totals for one post or Reel."""
    data = graph("GET", f"{media_id}/insights", metric="reach,views,likes,comments,saved,shares")["data"]
    return {m["name"]: m["values"][0]["value"] for m in data}

Node.js मा इनसाइट्स कसरी पढ्ने?

Node.js मा उही दुई अनुरोध, प्रत्येकले मेट्रिकको नामद्वारा कुञ्जी गरिएको वस्तु फिर्ता दिन्छ। कुनैले पनि breakdown पठाउँदैन: Meta ले चेतावनी दिन्छ कि मेट्रिकले समर्थन नगर्ने कुनै चीज माग्दा अनुरोध अज्ञात त्रुटिसँग असफल हुन्छ, र इनसाइट्सको डेटा 48 घण्टासम्म ढिलो हुन सक्छ, त्यसैले हालैका पोस्टहरू पछि फेरि पढ्नुहोस्।

Node.js: account and post insights
// Uses graph() and IG_ID from the helper above
// Reach, views and accounts engaged over the last 24 hours
export async function accountInsights() {
  const { data } = await graph("GET", `${IG_ID}/insights`, {
    metric: "reach,views,accounts_engaged",
    period: "day",
    metric_type: "total_value",
  });
  return Object.fromEntries(data.map((m) => [m.name, m.total_value?.value]));
}

// Totals for one post or Reel
export async function postInsights(mediaId) {
  const { data } = await graph("GET", `${mediaId}/insights`, { metric: "reach,views,likes,comments,saved,shares" });
  return Object.fromEntries(data.map((m) => [m.name, m.values?.[0]?.value]));
}

Python मा वेबहुक कसरी प्रमाणित गर्ने?

Flask सँग, एउटै बाटोमा दुई रुटमा। GET ले Meta को प्रमाणीकरण अनुरोधको जवाफ दिन्छ: जब hub.mode subscribe हुन्छ र hub.verify_token मेल खान्छ, यसले hub.challenge सादा पाठको रूपमा फिर्ता दिन्छ, अन्यथा 403। POST ले sha256= जोडेर कच्चा बडीको HMAC-SHA256 एप सिक्रेटसँग गणना गर्छ, X-Hub-Signature-256 सँग स्थिर समयमा तुलना गर्छ, र कुनै पनि ढिलो काम सुरु हुनु अघि 200 फर्काउँछ।

Python: webhook verification and signature check (Flask)
import hashlib
import hmac
import json
import os
from queue import Queue

from flask import Flask, abort, request

app = Flask(__name__)
VERIFY_TOKEN = os.environ["VERIFY_TOKEN"]
APP_SECRET = os.environ["APP_SECRET"].encode()
jobs: Queue = Queue()  # swap for your own job queue


@app.get("/webhooks/instagram")
def verify():
    """Meta's verification request: send hub.challenge back when the token matches."""
    args = request.args
    if args.get("hub.mode") == "subscribe" and args.get("hub.verify_token") == VERIFY_TOKEN:
        return args.get("hub.challenge", ""), 200, {"Content-Type": "text/plain"}
    abort(403)


@app.post("/webhooks/instagram")
def receive():
    """An event: check X-Hub-Signature-256 over the raw bytes, then answer at once."""
    raw = request.get_data()
    expected = b"sha256=" + hmac.new(APP_SECRET, raw, hashlib.sha256).hexdigest().encode()
    if not hmac.compare_digest(expected, request.headers.get("X-Hub-Signature-256", "").encode()):
        abort(401)
    for entry in json.loads(raw).get("entry", []):
        jobs.put(entry)  # slow work happens elsewhere; Meta wants a quick 200
    return "", 200

Node.js मा वेबहुक कसरी प्रमाणित गर्ने?

अन्तर्निर्मित http मोड्युल प्रयोग गरेर, कुनै फ्रेमवर्क नराखी। बडी केही पनि पार्स हुनु अघि कच्चा बाइटको रूपमा जम्मा गरिन्छ, किनकि पार्स गरेर पुनः सिरियलाइज गरिएको बडीले Meta ले गणना गरेको हस्ताक्षरसँग मेल खाँदैन। Meta ले असफल सूचना 36 घण्टासम्म पुनः पठाउँछ, त्यसैले ह्यान्डलरले पहिले नै प्रशोधन गरिसकेका घटनाहरू पनि छोड्नुपर्छ।

Node.js: webhook verification and signature check (node:http)
import crypto from "node:crypto";
import http from "node:http";

const { VERIFY_TOKEN, APP_SECRET } = process.env;
const PATH = "/webhooks/instagram";
const jobs = []; // swap for your own job queue

http
  .createServer((req, res) => {
    const url = new URL(req.url, "http://localhost");
    if (url.pathname !== PATH) return res.writeHead(404).end();

    if (req.method === "GET") {
      // Meta's verification request: send hub.challenge back when the token matches
      const ok =
        url.searchParams.get("hub.mode") === "subscribe" &&
        url.searchParams.get("hub.verify_token") === VERIFY_TOKEN;
      return res
        .writeHead(ok ? 200 : 403, { "Content-Type": "text/plain" })
        .end(ok ? url.searchParams.get("hub.challenge") ?? "" : "");
    }

    const chunks = [];
    req.on("data", (chunk) => chunks.push(chunk));
    req.on("end", () => {
      const raw = Buffer.concat(chunks); // the exact bytes Meta signed
      const expected = Buffer.from("sha256=" + crypto.createHmac("sha256", APP_SECRET).update(raw).digest("hex"));
      const given = Buffer.from(req.headers["x-hub-signature-256"] ?? "");
      if (given.length !== expected.length || !crypto.timingSafeEqual(given, expected)) {
        return res.writeHead(401).end();
      }
      res.writeHead(200).end(); // answer first, work after
      try {
        for (const entry of JSON.parse(raw.toString("utf8")).entry ?? []) jobs.push(entry);
      } catch {
        // not JSON: nothing to queue
      }
    });
  })
  .listen(3000);

कुन Meta त्रुटिहरूमा कोडले पुन: प्रयास गर्नुपर्छ?

केवल अस्थायी त्रुटिहरूमा, किनभने बाँकी कुरा केही नबदलिएसम्म उही जवाफ दिन्छन्: फाइल, यूआरएल, अनुमति वा खाताको अवस्था। Meta को त्रुटि सन्दर्भहरूले माथिका सहायकहरूले छुट्याउने प्रत्येक कोडका लागि गर्नुपर्ने कार्य दिन्छन्:

1, 2Temporary or downtime: wait, then retry
4, 17, 80002Throttling: wait for estimated_time_to_regain_access, then retry
4 with 2207051Suspected spam: stop, since a retry repeats the action
2207001, 2207003, 2207032Server error, download timeout or failed container: try again
2207008Container briefly missing: retry 1 to 2 times within 2 minutes
190, 102Token expired or invalid: refresh it while valid, or sign in again
10, 200 to 299Permission missing or removed: request it at sign-in
25 with 2207050Account restricted: the owner acts in the Instagram app
9 with 2207042Daily publishing limit: try again the next day
9004 with 2207052Media not fetched from the URL: fix the link

easyCoexistence का प्रमाणहरूमा उही कोड कसरी चलाउने?

तपाईंले यसलाई easyCoexistence को टोकनमा चलाउन सक्नुहुन्न: Instagram टोकन कहिल्यै दिइँदैन (Meta का सर्तहरू), त्यसैले get_social_credentials र Partner API को GET /api/v1/channels/:id?credentials=1 ले टोकनबिना खाताको ID र API base फर्काउँछन्। यसको सट्टा उही कामहरू MCP उपकरणको रूपमा चल्छन्, Claude, ChatGPT वा अन्य MCP क्लाइन्टमार्फत, र माथिका सहायकहरू तपाईंको आफ्नै Meta एपको टोकनमा बिना परिवर्तन चल्छन्।

What get_social_credentials returns for an Instagram account
{
  "platform": "instagram",
  "graph_api_base": "https://graph.instagram.com/<VERSION>",
  "account_id_on_meta": "<IG_ID>",
  "access_token": null,
  "token_note": "Meta's terms do not allow handing this account's access token to other apps, so it is not shown. ..."
}

MCP कनेक्टरमार्फत उही कामहरू कसरी गर्ने?

सहायकलाई सोधेर, वा उपकरणहरू आफैँ कल गरेर। publish_instagram_post ले कन्टेनर सिर्जना गरेर प्रकाशित गर्छ, भिडियो प्रशोधन हुँदा पर्खिन्छ, वा scheduled_at सँग 90 दिनसम्म अगाडि तालिका बनाउँछ; reply_to_comment सार्वजनिक रूपमा जवाफ दिन्छ, वा private को मान true गरेर DM मार्फत निजी रूपमा; get_social_insights ले मेट्रिकका नामहरू सीधै Meta मा पठाउँछ; र set_social_webhook_destination ले कमेन्ट, उल्लेख र DM हरू X-EC-Signature सँग हस्ताक्षरित गरी तपाईंको एन्डपोइन्टमा पठाउँछ।

MCP tool calls for the same jobs
[
  {
    "name": "publish_instagram_post",
    "arguments": {
      "account_id": "<from list_social_accounts>",
      "type": "REELS",
      "video_url": "https://cdn.example.com/launch.mp4",
      "caption": "Launch day.",
      "scheduled_at": "2026-11-06T09:00:00-03:00"
    }
  },
  {
    "name": "list_social_comments",
    "arguments": { "account_id": "<ACCOUNT_ID>", "post_id": "<IG_MEDIA_ID>" }
  },
  {
    "name": "reply_to_comment",
    "arguments": { "account_id": "<ACCOUNT_ID>", "comment_id": "<IG_COMMENT_ID>", "text": "Prices are in our bio link." }
  },
  {
    "name": "get_social_insights",
    "arguments": {
      "account_id": "<ACCOUNT_ID>",
      "metrics": ["reach", "views", "accounts_engaged"],
      "period": "day",
      "params": { "metric_type": "total_value" }
    }
  },
  {
    "name": "set_social_webhook_destination",
    "arguments": { "account_id": "<ACCOUNT_ID>", "url": "https://hooks.example.com/instagram" }
  }
]

सामान्य गल्तीहरू

  • पार्स गरिएको JSON को ह्यास निकाल्नु। Meta ले कच्चा बाइटमा हस्ताक्षर गर्छ, त्यसैले फ्रेमवर्कको JSON बडी पार्सरले X-Hub-Signature-256 जाँच बिगार्छ; कच्चा बडी राख्नुहोस् र पछि पार्स गर्नुहोस्।
  • टाइमआउटपछि नहेरी media_publish फेरि कल गर्नु। कन्टेनरको status_code PUBLISHED पढिन्छ भने पोस्ट पहिल्यै लाइभ छ।
  • subcode बिना कोड 4 लाई थ्रोटलिङ ठान्नु। 2207051 सँग यसको अर्थ Instagram ले स्प्याम शंका गर्छ, र पुन: प्रयासले त्यही काम दोहोर्‍याउँछ जसलाई त्यसले भर्खरै प्रतिबन्ध लगाएको थियो।
  • ब्राउजर वा मोबाइल कोडबाट एप सिक्रेट वा टोकन पठाउनु। Meta भन्छ कि एप सिक्रेट बोक्ने अनुरोधहरू सर्भर-साइड कोडमा मात्र बस्नुपर्छ।
EasyCoexistence मार्फत यो काम

प्रति कनेक्सन प्रति महिना US$ 9 देखि US$ 0.75 सम्म, कनेक्सन थप्दै जाँदा घट्दै, पहिलो 3 दिन निःशुल्क।

बारम्बार सोधिने प्रश्नहरू

Instagram API कल गर्न SDK चाहिन्छ?

छैन। प्रत्येक कल एक्सेस टोकनसहितको HTTPS अनुरोध हो, त्यसैले यस पृष्ठका उदाहरणहरूमा देखाइए जस्तै Python मा requests वा Node.js मा fetch ले पुग्छ।

Reel कन्टेनर बनाएपछि तुरुन्तै media_publish किन असफल हुन्छ?

भिडियो अझै प्रशोधन हुँदैछ: त्रुटि 9007 subcode 2207027 सँग। कन्टेनरको status_code हरेक मिनेट जाँच्नुहोस् र यसले FINISHED पढेपछि प्रकाशित गर्नुहोस्।

कुन एपीआई संस्करण प्रयोग गर्नुपर्छ?

Meta ले अझै सेवा दिइरहेको संस्करण: v26.0 नवीनतम हो, र प्रत्येक संस्करण कम्तीमा दुई वर्षसम्म चल्छ। हटाइएको संस्करणमा गरिएको कल अर्को सबैभन्दा पुरानो, अझै उपलब्ध संस्करणमा चल्छ।

easyCoexistence ले Instagram खातामा एपीआई पहुँचका लागि कति लिन्छ?

प्रत्येक Instagram खाता एउटा कनेक्सन हो: प्रति कनेक्सन प्रति महिना US$ 9 देखि US$ 0.75 सम्म, कनेक्सन थप्दै जाँदा घट्दै, पहिलो 3 दिन निःशुल्क।

पढ्दै जानुहोस्

2026 का लागि Instagram API गाइड: तपाईंको एपदेखि पहिलो पोस्टसम्म2026 मा Instagram API का चरणहरू: खाता, लग इन सेटअप, Meta एप, अनुमति, टोकन, पहिलो पोस्ट, कमेन्ट, DM, वेबहुक र सीमा।Instagram API कनेक्सन किन काम गर्न छोड्छ, र यसलाई कसरी चालु राख्नेInstagram API कनेक्सन किन रोकिन्छ: म्याद सकिएको टोकन, पासवर्ड परिवर्तन, हटाइएको अनुमति वा एप, व्यक्तिगत खाता, प्रतिबन्ध र प्रत्येकको समाधान।Instagram एक्सेस टोकनहरू: दीर्घकालीन टोकन, 60 दिन र रिफ्रेसInstagram Login का टोकनहरू कसरी काम गर्छन्: लगइनपछि एक घण्टाको टोकन, 60 दिन मान्य दीर्घकालीन टोकन, र 24 घण्टापछि रिफ्रेस गर्न सकिन्छ।Instagram वेबहुक इभेन्ट: कमेन्ट, मेन्सन र DMInstagram का कमेन्ट, मेन्सन र DM वेबहुक इभेन्टका रूपमा तपाईंको एन्डपोइन्टमा कसरी आउँछन्, प्रत्येक पेलोडमा के हुन्छ, र हस्ताक्षर कसरी जाँच्ने।Instagram एपीआई प्रकाशन सीमा: फर्म्याट, साइज र दैनिक पोस्टInstagram एपीआई मार्फत प्रकाशित गर्न सकिने ढाँचा र दैनिक सीमा: 8 MB सम्मका JPEG, Reels, Stories, 2,200 अक्षरका क्याप्सन र 24 घण्टामा 100 पोस्टClaude र ChatGPT का लागि Instagram MCP सर्भरClaude, ChatGPT र अन्य AI एजेन्टका लागि Instagram MCP सर्भर: पोस्ट, Reels र Stories तालिकाबद्ध गर्नुहोस्, टिप्पणी र DM को जवाफ दिनुहोस्।

दुई मिनेटमै आफ्नो पहिलो च्यानल जडान गर्नुहोस्।

प्लेटफर्मको समीक्षा कुर्नुपर्दैन। WhatsApp, Instagram, TikTok वा अर्को च्यानल जडान गर्नुहोस्, अनि आफ्नो AI लाई पोस्ट गर्न, जवाफ दिन वा रिपोर्ट बनाउन भन्नुहोस् र काम भइरहेको हेर्नुहोस्।

  • 3 दिन निःशुल्क
  • जुनसुकै बेला रद्द गर्नुहोस्
  • आधिकारिक एपीआई मात्र
  • 24/7 निगरानी

प्रमाणीकरण गरिएको