লগ ইনফ্রি ট্রায়াল শুরু করুন
easyCoexistence অফিসিয়াল API

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 মেট্রিক ফেরত দেয়, আর একটি ওয়েবহুক যাচাই হয় raw body-এর HMAC-SHA256 দিয়ে। প্রতিটি ত্রুটিতে একটি কোড ও সাবকোড থাকে, যা ঠিক করে পুনরায় চেষ্টা কাজ করবে কিনা।

easyCoexistence একই কাজগুলো MCP টুল হিসেবে চালায় Claude, ChatGPT বা আপনার নিজের এজেন্টের জন্য, টোকেন নিজের দিকে রেখে: publish_instagram_post, reply_to_comment, get_social_insights ও set_social_webhook_destination, Meta-র অফিশিয়াল API-তে।

v26.0

সর্বশেষ Graph API ভার্সন, 29 জুলাই 2026-এ চালু হয়েছে; v25.0 29 জুলাই 2028 পর্যন্ত উপলব্ধ থাকবে।

Once a minute

ভিডিও কন্টেইনারের status_code কত ঘন ঘন দেখা উচিত, সর্বোচ্চ 5 মিনিট পর্যন্ত, Meta যেমন পরামর্শ দেয়।

50

একটি GET /<IG_MEDIA_ID>/comments অনুরোধে সর্বোচ্চ কতগুলো কমেন্ট ফেরত আসে; উত্তর (replies) শুধু ফিল্ড এক্সপ্যানশনের মাধ্যমে আসে।

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, হোস্ট ও API ভার্সন।
  • IG_ID: প্রফেশনাল অ্যাকাউন্টের ID, অর্থাৎ GET /me যে user_id ফেরত দেয়।
  • TOKEN: একটি দীর্ঘমেয়াদি Instagram User অ্যাক্সেস টোকেন, সার্ভারে গোপন রাখা।
  • APP_SECRET ও VERIFY_TOKEN: ওয়েবহুকের অনুরোধ যাচাই করার জন্য।

Python-এ কীভাবে API কল করবেন ও ত্রুটি সামলাবেন?

একটি হেল্পার দিয়ে, যা নিচের Python উদাহরণগুলো একসাথে ব্যবহার করে। এটি টোকেন access_token হিসেবে পাঠায়, Meta-র কোড, সাবকোড ও fbtrace_id সহ MetaError তোলে, এবং শুধু সেগুলোতেই পুনরায় চেষ্টা করে যেগুলোকে Meta সাময়িক বলে: কোড 1 ও 2, থ্রটলিং কোড 4, 17 ও 80002, এবং সাবকোড 2207001, 2207003, 2207008 ও 2207032। কোড 4 সাবকোড 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-এ কীভাবে API কল করবেন ও ত্রুটি সামলাবেন?

Node.js 18 বা তার পরের সংস্করণের জন্য একই হেল্পার দিয়ে, যা fetch ব্যবহার করে এবং কোনো ডিপেন্ডেন্সি লাগে না। থ্রটল হওয়া কল অপেক্ষা করে estimated_time_to_regain_access-এর জন্য, যে মিনিট Meta X-Business-Use-Case-Usage হেডারে জানায়, না থাকলে 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-এ কীভাবে ছবি ও রিল প্রকাশ করবেন?

দুটিই কন্টেইনার ফ্লো অনুসরণ করে। একটি ছবির কন্টেইনার সঙ্গে সঙ্গে প্রস্তুত হয়, তাই media_publish সরাসরি তার পরেই আসে। রিলের ভিডিও আগে প্রসেস হয়: ফাংশনটি Meta-র পরামর্শ অনুযায়ী প্রতি মিনিটে status_code দেখে, সর্বোচ্চ 5 মিনিট পর্যন্ত, এবং FINISHED হলে প্রকাশ করে, আর ERROR বা EXPIRED হলে থামে। ছবি অবশ্যই JPEG হতে হবে, এবং মিডিয়াটি একটি পাবলিক 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-এ কীভাবে ছবি ও রিল প্রকাশ করবেন?

একই দুটি ফাংশন, প্রতিটি নতুন মিডিয়া 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 চায়, এবং পোস্ট বা রিলের জন্য 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-এ একই দুটি অনুরোধ, প্রতিটি মেট্রিকের নাম অনুযায়ী সাজানো একটি অবজেক্ট ফেরত দেয়। কোনোটিই ব্রেকডাউন পাঠায় না: 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 ত্রুটিগুলোতে কোডের পুনরায় চেষ্টা করা উচিত?

শুধু সাময়িকগুলোতে, কারণ বাকিগুলো কিছু না বদলানো পর্যন্ত একই উত্তর দেয়: ফাইল, URL, অনুমতি বা অ্যাকাউন্টের অবস্থা। উপরের হেল্পারগুলো যেসব কোড আলাদা করে চেনে, তার প্রতিটির জন্য কী করতে হবে তা 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 দেখায়, পোস্টটি আগেই লাইভ।
  • সাবকোড ছাড়া কোড 4-কে থ্রটলিং ধরা। 2207051 সহ এর মানে Instagram স্প্যাম সন্দেহ করছে, আর পুনরায় চেষ্টা সেই কাজটিই আবার করে যা সে মাত্র সীমাবদ্ধ করেছে।
  • ব্রাউজার বা মোবাইল কোড থেকে অ্যাপ সিক্রেট বা টোকেন পাঠানো। Meta বলে অ্যাপ সিক্রেটসহ অনুরোধ শুধু সার্ভার-সাইড কোডে থাকা উচিত।
EasyCoexistence দিয়ে এটি করা

প্রতি সংযোগ প্রতি মাসে US$ 9 থেকে US$ 0.75 পর্যন্ত, সংযোগ বাড়ানোর সাথে কমে, প্রথম 3 দিন ফ্রি।

প্রায়শই জিজ্ঞাসিত প্রশ্ন

Instagram API কল করতে কি SDK লাগে?

না। প্রতিটি কল একটি অ্যাক্সেস টোকেনসহ HTTPS অনুরোধ, তাই এই পাতার উদাহরণগুলো যেমন দেখায়, Python-এর requests বা Node.js-এর fetch-ই যথেষ্ট।

রিল কন্টেইনার তৈরির ঠিক পরেই media_publish কেন ব্যর্থ হয়?

ভিডিও তখনও প্রসেস হচ্ছে: ত্রুটি 9007, সাবকোড 2207027। কন্টেইনারের status_code প্রতি মিনিটে একবার দেখুন এবং FINISHED দেখালে প্রকাশ করুন।

কোডের কোন API ভার্সন ব্যবহার করা উচিত?

যেটি Meta এখনও সরবরাহ করে: v26.0 সর্বশেষ, এবং প্রতিটি ভার্সন কমপক্ষে দুই বছর টিকে। একটি সরিয়ে ফেলা ভার্সনে কল পরবর্তী সবচেয়ে পুরোনো, এখনও উপলব্ধ ভার্সনে চলে।

একটি Instagram অ্যাকাউন্টের API অ্যাক্সেসের জন্য easyCoexistence-এর খরচ কত?

প্রতিটি 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 API পাবলিশিং সীমা: ফরম্যাট, সাইজ এবং দিন প্রতি পোস্টInstagram API পোস্টে কী থাকতে পারে এবং দিনে কতটি: 8 MB পর্যন্ত JPEG ছবি, Reels, Stories, 2,200 অক্ষরের ক্যাপশন এবং 24 ঘণ্টায় 100 পোস্ট।Claude ও ChatGPT-এর জন্য Instagram MCP সার্ভারClaude, ChatGPT ও অন্য AI এজেন্টের জন্য Instagram MCP সার্ভার। পোস্ট করুন ও শিডিউল করুন, কমেন্ট ও DM-এর উত্তর দিন, ইনসাইটস পড়ুন।

দুই মিনিটে আপনার প্রথম চ্যানেল সংযুক্ত করুন।

প্ল্যাটফর্মের রিভিউয়ের জন্য অপেক্ষা করতে হবে না। WhatsApp, Instagram, TikTok বা অন্য কোনো চ্যানেল সংযুক্ত করুন, তারপর আপনার AI-কে পোস্ট করতে, রিপ্লাই দিতে বা রিপোর্ট দিতে বলুন, আর নিজের চোখে দেখুন কীভাবে কাজ করে।

  • 3 দিন ফ্রি
  • যেকোনো সময় বাতিল করুন
  • শুধুমাত্র অফিশিয়াল API
  • 24/7 পর্যবেক্ষণ

যাচাই করা হয়েছে