පුරනය වන්නනොමිලේ trial කාලය ආරම්භ කරන්න
easyCoexistence නිල API

Python සහ Node.js හි Instagram API: ක්‍රියාත්මක උදාහරණ

Instagram API හට HTTPS හැර වෙන කිසිවක් අවශ්‍ය නැත, එබැවින් Python හි requests සහ Node.js හි built-in fetch මගින් එය ආවරණය කළ හැක: POST /<IG_ID>/media සහ media_publish පළ කරයි, /<IG_MEDIA_ID>/comments සහ /<IG_COMMENT_ID>/replies comments කියවා ඒවාට පිළිතුරු දෙයි, /insights මිනුම් ලබා දෙයි, webhook එකක් HMAC-SHA256 මගින් raw body එක සත්‍යාපනය කරයි. සෑම දෝෂයකටම code සහ subcode ඇති අතර, ඒවා retry එකකට උදව් වේද නැද්ද යන්න තීරණය කරයි.

easyCoexistence එම jobs ම Claude, ChatGPT හෝ ඔබේ agent එකට MCP tools ලෙස ක්‍රියාත්මක කරයි, token එක එහි පැත්තේ තබාගෙන: publish_instagram_post, reply_to_comment, get_social_insights සහ set_social_webhook_destination, Meta හි නිල API හරහා.

v26.0

නවතම Graph API version එක, 2026 ජූලි 29 හඳුන්වා දෙන ලදී; v25.0 2028 ජූලි 29 දක්වා ලබා ගත හැක.

Once a minute

Meta video container එකක status_code පරීක්ෂා කරන්නැයි යෝජනා කරන වාර ගණන, මිනිත්තු 5ට වඩා වැඩි නොවන කාලයක් සඳහා.

50

එක GET /<IG_MEDIA_ID>/comments ඉල්ලීමකින් ලැබෙන උපරිම comments ගණන; පිළිතුරු ලැබෙන්නේ field expansion හරහා පමණි.

2207008

තාවකාලික පළ කිරීමේ දෝෂයක්, Meta කියන්නේ තත්පර 30ක් සිට මිනිත්තු 2ක් ඇතුළත 1ත් 2ත් අතර retry කරන්නැයි.

sha256=

X-Hub-Signature-256 හි ඇති prefix එක, යෙදුම් රහසෙහි (app secret) යතුර සමඟ payload හි HMAC-SHA256 ට පෙර.

උදාහරණවලට අවශ්‍ය දේවල් මොනවාද?

Runtime එකක්, token එකක් සහ අගයන් හතරක්. උදාහරණ Instagram Login සමඟ graph.instagram.com මත Instagram API ඇමතුම් කරයි; Unified Login app එකක් එම paths ම භාවිත කරයි, එහි ගිණුමේ ID සහ Facebook Login Graph host එක මත Business Integration System User token එක සමඟ. Python සඳහා requests package එකත්, webhook සඳහා Flask එකත් අවශ්‍ය වන අතර, Node.js සඳහා built-in fetch සඳහා version 18 හෝ ඊට පසු අවශ්‍ය වේ.

  • GRAPH: https://graph.instagram.com/v26.0, host සහ API version එක.
  • IG_ID: වෘත්තීය ගිණුමේ ID එක, GET /me ලබා දෙන user_id එක.
  • TOKEN: දිගුකාලීන Instagram User access token එක, server එකේ තබා ගන්න.
  • APP_SECRET සහ VERIFY_TOKEN: webhook ඉල්ලීම් සත්‍යාපනය කිරීම සඳහා.

Python හි API ඇමතීම සහ දෝෂ හැසිරවීම කෙසේද?

Python උදාහරණ සියල්ල බෙදා ගන්නා එක helper එකක් හරහා. එය token එක access_token ලෙස යවන අතර, Meta හි code, subcode සහ fbtrace_id සමඟ MetaError එක විසි කරයි, සහ Meta තාවකාලික ලෙස නම් කරන දේ පමණක් retry කරයි: codes 1 සහ 2, throttling codes 4, 17 සහ 80002, සහ subcodes 2207001, 2207003, 2207008 සහ 2207032. Code 4 සමඟ subcode 2207051 ඇත්නම් එය spam ලෙස සැක කෙරේ, එබැවින් වහාම නවතී.

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 හි API ඇමතීම සහ දෝෂ හැසිරවීම කෙසේද?

Node.js 18 හෝ ඊට පසු සඳහා එම helper එකම, fetch භාවිත කර dependencies නැතිව. Throttle වූ ඇමතුමක් estimated_time_to_regain_access එකට, එනම් X-Business-Use-Case-Usage header එකේ Meta වාර්තා කරන මිනිත්තු ගණනට, එය නොමැති නම් තත්පර 60ක් බලා සිටී; මන්ද Meta throttle වී තිබියදී කරන ඇමතුම් ගණන් කරයි. needsNewToken මගින් කේත 190 සහ 102 සලකුණු වන අතර, කිසිම retry එකකින් ඒවා නිවැරදි කළ නොහැක.

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 එකක් පළ කරන්නේ කෙසේද?

දෙකම container flow එක අනුගමනය කරයි. ඡායාරූප container එක වහාම සූදානම් වන නිසා, media_publish එය ඉන් පසුව ම එන්නේ ය. Reel එකේ video මුලින් සකසනු ලැබේ: Meta යෝජනා කරන පරිදි, function එක මිනිත්තුවකට වරක් status_code පරීක්ෂා කරන අතර, මිනිත්තු 5ක් දක්වා, FINISHED වූ විට පළ කරයි, සහ ERROR හෝ EXPIRED වූ විට නවතී. රූප JPEG විය යුතු අතර, media එය public URL එකක තිබිය යුතුය.

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 එකක් පළ කරන්නේ කෙසේද?

එම functions දෙක, එක් එකක් නව media ID එක ලබා දෙයි. පරීක්ෂා පහක් ගෙවූ පසුත් IN_PROGRESS ලෙස පවතින container එකක් එය සෑදූ වේලාවේ සිට පැය 24ක් දක්වා වලංගුව පවතී, එබැවින් දෝෂ පණිවිඩය කියන්නේ පසුව නැවත පරීක්ෂා කරන ලෙසයි; එය ගිණුමේ දිනකට 400ක සීමාවට එරෙහිව දෙවන container එකක් සෑදීම වළක්වයි.

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 හි comments කියවා පිළිතුරු දෙන්නේ කෙසේද?

GET /<IG_MEDIA_ID>/comments මගින් top-level comments, අලුත්ම පළමුව, එක් ඉල්ලීමකට 50ක් දක්වා ලැබේ; POST /<IG_COMMENT_ID>/replies මගින් එකකට පොදු පිළිතුරක් පළ කරයි. Function එක එක් පිළිතුරක පෙළ සඳහා ඔබේ callback එකෙන් ඉල්ලන අතර, ඒ සඳහා කිසිවක් ලැබෙන comments මඟ හරියි. සඟවන ලද comments වලට පිළිතුරු දිය නොහැකි අතර, පිළිතුරකට දෙන පිළිතුර top-level comment එකට යයි.

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 හි comments කියවා පිළිතුරු දෙන්නේ කෙසේද?

Node.js හි එම loop එකම. දෙකම ඇමතුම් instagram_business_basic සහ instagram_business_manage_comments භාවිත කරන අතර, username field එකට දෙවැන්න අවශ්‍ය වේ. ඒ වෙනුවට පෞද්ගලිකව පිළිතුරු දීමට, POST /<IG_ID>/messages සමඟ recipient.comment_id, comment එකෙන් දින 7ක් ඇතුළත අදහස් දක්වන්නාට DM එකක් යවයි, සහ follow-up එක ඔවුන් පිළිතුරු දෙන තෙක් බලා සිටී.

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 හි insights කියවන්නේ කෙසේද?

Account insights period=day සහ metric_type=total_value සමඟ ලබා ගන්නා අතර, එවිට එක් metric එකක total_value.value වාර්තා කරයි; post එකක insights, values[0].value වාර්තා කරයි. උදාහරණය ගිණුම මත reach, views සහ accounts_engaged ද, post හෝ Reel එකක් මත reach, views, likes, comments, saved සහ shares ද ඉල්ලයි, ඒවා Meta ගේ reference එකේ දෙකටම ලැයිස්තුගත වේ. දත්ත නොමැති metric එකක් 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 හි insights කියවන්නේ කෙසේද?

Node.js හි එම ඉල්ලීම් දෙකම, එක් එක් metric නමෙන් යතුරු කර ඇති object එකක් ලබා දෙයි. කිසිවක් breakdown එකක් යවන්නේ නැත: Meta අවවාද කරන්නේ, metric එකකට සහාය නොදක්වන breakdown එකක් ඉල්ලුවහොත් ඉල්ලීම unknown error එකකින් අසාර්ථක වන බවත්, insights දත්ත පැය 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 හි webhook එකක් සත්‍යාපනය කරන්නේ කෙසේද?

Flask සමඟ, එක path එකක routes දෙකකින්. GET එක Meta ගේ සත්‍යාපන ඉල්ලීමට පිළිතුරු දෙයි: hub.mode subscribe වන විට සහ hub.verify_token ගැලපෙන විට, එය hub.challenge plain text ලෙස ලබා දෙන අතර, එසේ නොවේ නම් 403 ලබා දෙයි. POST එක sha256= සහ raw body එකේ HMAC-SHA256 යෙදුම් රහස සමඟ ගණනය කර, X-Hub-Signature-256 සමඟ constant time එකේ සංසන්දනය කරන අතර, මන්දගාමී වැඩ ආරම්භ කිරීමට පෙර 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 හි webhook එකක් සත්‍යාපනය කරන්නේ කෙසේද?

Framework එකක් නැතිව, built-in http module එකෙන්. කිසිවක් parse කිරීමට පෙර body එක raw bytes ලෙස එකතු කෙරේ, මන්ද parse කර නැවත serialize කළ body එක Meta ගණනය කළ signature එකට තවදුරටත් නොගැලපේ. Meta අසාර්ථක notification එකක් පැය 36ක් දක්වා නැවත යවන බැවින්, handler එක දැනටමත් සකසා ඇති events ද මඟ හැරිය යුතුය.

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);

කේතය retry කළ යුත්තේ Meta දෝෂ මොනවාද?

තාවකාලික ඒවා පමණි, මන්ද අනෙක් ඒවා යමක් වෙනස් වන තෙක් එකම පිළිතුර ලබා දෙයි: ගොනුව, URL එක, අවසරය, හෝ ගිණුමේ තත්ත්වය. ඉහත helpers වෙන් කරන සෑම code එකක් සඳහාම ක්‍රියාව 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 හි credentials මත එම කේතය ක්‍රියාත්මක කරන්නේ කෙසේද?

ඔබට එය easyCoexistence හි token මත ක්‍රියාත්මක කළ නොහැක: Instagram tokens කිසිදා ලබා නොදේ (Meta හි නියමයන්), එබැවින් get_social_credentials සහ Partner API හි GET /api/v1/channels/:id?credentials=1 token නොමැතිව ගිණුමේ ID එක සහ API base ලබා දෙයි. ඒ වෙනුවට එම jobs ම MCP tools ලෙස ක්‍රියාත්මක වේ, Claude, ChatGPT හෝ වෙනත් MCP client එකක් හරහා, සහ ඉහත helpers ඔබේම Meta app එකේ token එකක් මත වෙනස් නොවී ක්‍රියා කරයි.

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. ..."
}

එම jobs MCP connector හරහා කරන්නේ කෙසේද?

සහායකයාගෙන් ඉල්ලීමෙන්, හෝ tools ඔබ ම ඇමතීමෙන්. publish_instagram_post container එක සාදා පළ කරයි, video සකසන අතර බලා සිටියි, හෝ scheduled_at සමඟ දින 90ක් ඉදිරියට කාලසටහන් කරයි; reply_to_comment පොදුවේ පිළිතුරු දෙයි, හෝ private true සමඟ DM මගින් පෞද්ගලිකව; get_social_insights metric නම් Meta වෙත කෙලින්ම යවයි; set_social_webhook_destination comments, mentions සහ DMs ඔබේ endpoint එකට forward කරයි, 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" }
  }
]

සාමාන්‍ය වැරදි

  • Parse කළ JSON hash කිරීම. Meta raw bytes අත්සන් කරන බැවින්, framework එකක JSON body parser එකක් X-Hub-Signature-256 පරීක්ෂාව බිඳ දමයි; raw body එක තබා ගෙන පසුව parse කරන්න.
  • Timeout වීමකින් පසු බලා නොමැතිව media_publish නැවත ඇමතීම. Container එකේ status_code PUBLISHED ලෙස කියවෙන්නේ නම්, පළ කිරීම දැනටමත් ප්‍රසිද්ධියේ ඇත.
  • Subcode නැතිව code 4 throttling ලෙස කියවීම. 2207051 සමඟ එයින් අදහස් වන්නේ Instagram spam ලෙස සැක කරන බවයි, retry එකක් ඒ මොහොතේ සීමා කළ ක්‍රියාව ම නැවත කරයි.
  • Browser හෝ mobile කේතයෙන් app secret හෝ token යැවීම. Meta පවසන්නේ app secret සහිත ඉල්ලීම් server-side කේතයේ පමණක් තිබිය යුතු බවයි.
EasyCoexistence සමඟ මෙය කිරීම

සම්බන්ධතාවයකට මාසිකව US$ 9 සිට US$ 0.75 දක්වා, සම්බන්ධතා එකතු කරන විට අඩු වෙමින්, පළමු දින 3ක නොමිලේ trial කාලය සමඟ.

නිතර අසන ප්‍රශ්න

Instagram API ඇමතීමට SDK එකක් අවශ්‍යද?

නැත. සෑම ඇමතුමක්ම access token එකක් සහිත HTTPS ඉල්ලීමක් වන බැවින්, මෙම පිටුවේ උදාහරණ පෙන්වන පරිදි Python හි requests හෝ Node.js හි fetch ප්‍රමාණවත් වේ.

Reel container එක සෑදූ වහාම media_publish අසාර්ථක වන්නේ ඇයි?

Video තවමත් සකසමින් ඇත: error 9007 සහ subcode 2207027. Container එකේ status_code මිනිත්තුවකට වරක් පරීක්ෂා කර, FINISHED ලෙස කියවෙන විට පළ කරන්න.

කේතය කුමන API version එක භාවිත කළ යුතුද?

Meta තවමත් සේවය කරන එකක්: v26.0 නවතම වන අතර, සෑම version එකක්ම අවම වශයෙන් අවුරුදු දෙකක් පවතී. ඉවත් කළ version එකකට කරන ඇමතුමක් ඊළඟ පැරණිතම, තවමත් ලබා ගත හැකි version එකේ ක්‍රියාත්මක වේ.

Instagram ගිණුමක API ප්‍රවේශය සඳහා easyCoexistence කොපමණ වියදම් වේද?

එක් Instagram ගිණුමක් එක සම්බන්ධතාවයකි: සම්බන්ධතාවයකට මාසිකව US$ 9 සිට US$ 0.75 දක්වා, සම්බන්ධතා එකතු කරන විට අඩු වෙමින්, පළමු දින 3ක නොමිලේ trial කාලය සමඟ.

තවදුරටත් කියවන්න

2026 සඳහා Instagram API මාර්ගෝපදේශය: ඔබේ යෙදුමේ සිට ඔබේ පළමු post එක දක්වා2026 හි Instagram API මාර්ගය පියවරෙන් පියවර: ගිණුම, පිවිසුම, Meta යෙදුම, අවසර, token, පළමු post, comments, DMs, webhook එක සහ සීමා.Instagram API සම්බන්ධතාවය නවතින්නේ ඇයි, එය සක්‍රියව තබා ගන්නේ කෙසේදInstagram API සම්බන්ධතාවය නවතින හේතු: කල්ඉකුත් වූ token, මුරපද වෙනසක්, ඉවත් කළ අවසරය හෝ app එක, පුද්ගලික ගිණුම, සීමාව, සහ එක් එක් විසඳුම.Instagram access token එක: දින 60ක long-lived token සහ refresh කිරීමInstagram Login access token: login එකෙන් පසු පැය 1ක්, දින 60ක long-lived token එක සහ refresh කරන ආකාරය.Instagram webhook events: comments, mentions සහ DMsInstagram comments, mentions සහ DMs webhook event ලෙස endpoint එකට එන ආකාරය, payload එක සහ signature එක පරීක්ෂා කිරීම.Instagram API publish සීමාවන්: ආකෘති, ප්‍රමාණ සහ දිනකට post ගණනInstagram API post එකට ගැලපෙන ආකෘති සහ දිනකට සීමාව: JPEG රූප 8 MB දක්වා, Reels, Stories, අක්ෂර 2,200 caption සහ පැය 24 තුළ post 100.Claude සහ ChatGPT සඳහා Instagram MCP serverClaude, ChatGPT සහ අනෙකුත් AI agent සඳහා Instagram MCP server: posts සහ Reels publish කර schedule කරන්න, comments සහ DMs වලට reply කරන්න.

ඔබේ පළමු channel එක මිනිත්තු දෙකකින් සම්බන්ධ කරන්න.

වේදිකා සමාලෝචන සඳහා බලා සිටීමට අවශ්‍ය නැත. WhatsApp, Instagram, TikTok හෝ වෙනත් channel එකක් සම්බන්ධ කර, පසුව ඔබේ AI හට පළ කිරීමට, ප්‍රතිචාර දැක්වීමට හෝ වාර්තා කිරීමට පවසා එය වැඩ කරන ආකාරය බලන්න.

  • දින 3ක් නොමිලේ
  • ඕනෑම වේලාවක අවලංගු කරන්න
  • නිල API පමණි
  • 24/7 නිරීක්ෂණය කෙරේ

සත්‍යාපනය කළේ