Instagram 發佈

了解如何連結 Instagram 商業帳號,並發佈照片、輪播貼文與 Reels。

連結 Instagram 帳號

前置需求

注意:Instagram 授權流程採用 Instagram 原生 OAuth,不需要先連結 Facebook 粉絲專頁。

如何將個人帳號轉為商業帳號

若目前是個人帳號:

  1. 開啟 Instagram App
  2. 前往 設定帳號
  3. 點擊 「切換到專業帳號」
  4. 選擇 BusinessCreator
  5. 依指示完成設定

連結步驟

  1. 在控制台按下 「Connect Instagram」
  2. 如尚未登入 Instagram,請先登入
  3. 授權 Boring 存取你的 Instagram 帳號
  4. 授與所需權限:
    • instagram_business_basic:帳號基本資訊
    • instagram_business_content_publish:發佈內容
    • instagram_business_manage_comments:管理留言
    • instagram_business_manage_messages:管理私訊
  5. 點擊 「Authorize」

完成後,帳號會顯示於「Authorized Accounts」列表,包含:

權杖資訊

重要:每 60 天必須重新連結 Instagram 帳號一次。

支援的內容類型

透過 Boring 可在 Instagram 發佈以下貼文:

類型 說明 媒體數量 範例
照片 單張圖片貼文 1 產品照、生活照
輪播 多張圖片貼文 2-10 系列照片、前後對比
Reels 短影音 1 教學影片、精華剪輯

注意:Instagram 不支援純文字貼文,所有貼文都必須包含媒體。

發佈範例

1. 單張照片貼文

{
  "post": {
    "accountId": "your-instagram-account-id",
    "content": {
      "text": "Beautiful sunset 🌅 #nature #photography",
      "mediaUrls": ["https://example.com/sunset.jpg"],
      "platform": "instagram"
    },
    "target": {
      "targetType": "instagram"
    }
  }
}

效果:在 Instagram 貼文牆上建立單張圖片貼文。

照片規格

2. 輪播貼文

{
  "post": {
    "accountId": "your-instagram-account-id",
    "content": {
      "text": "Swipe to see our new collection! ➡️ #fashion #newcollection",
      "mediaUrls": [
        "https://example.com/photo1.jpg",
        "https://example.com/photo2.jpg",
        "https://example.com/photo3.jpg",
        "https://example.com/photo4.jpg"
      ],
      "platform": "instagram"
    },
    "target": {
      "targetType": "instagram"
    }
  }
}

效果:建立可左右滑動的輪播貼文。

輪播限制

3. Reels 影片

{
  "post": {
    "accountId": "your-instagram-account-id",
    "content": {
      "text": "New product teaser 🔥 Turn on sound! #reels #productlaunch",
      "mediaUrls": ["https://example.com/reel.mp4"],
      "platform": "instagram"
    },
    "target": {
      "targetType": "instagram"
    }
  }
}

效果:在 Reels 中發佈 9:16 的短影音。

Reels 規格

API 請求格式

Python 完整範例

import requests

API_URL = "https://boring.aiagent-me.com/v2/posts"
API_KEY = "boring_xxxxxxxxxxxxx"
ACCOUNT_ID = "your-instagram-account-id"

# 輪播範例
post_data = {
    "post": {
        "accountId": ACCOUNT_ID,
        "content": {
            "text": "Product showcase! Swipe for details ➡️\n\n#products #shopping #newrelease",
            "mediaUrls": [
                "https://storage.example.com/product-main.jpg",
                "https://storage.example.com/product-detail1.jpg",
                "https://storage.example.com/product-detail2.jpg"
            ],
            "platform": "instagram"
        },
        "target": {
            "targetType": "instagram"
        }
    }
}

headers = {
    "boring-api-key": API_KEY,
    "Content-Type": "application/json"
}

response = requests.post(API_URL, headers=headers, json=post_data)
result = response.json()

if result["success"]:
    print(f"Published! Media ID: {result['data']['media_id']}")
else:
    print(f"Error: {result['message']}")

成功回應

{
  "success": true,
  "message": "Post published successfully",
  "data": {
    "media_id": "12345678901234567",
    "post_type": "carousel",
    "platform": "instagram",
    "page_name": "your_username",
    "item_count": 3,
    "published_at": "2025-01-20T10:30:00Z"
  }
}

媒體 URL 要求

圖片規格

Instagram 對圖片品質要求嚴格:

最低條件

建議標準

影片規格

Reels 要求

媒體託管

與 Facebook 規範相同,媒體 URL 必須:

發佈前測試 URL:

curl -I https://example.com/image.jpg
# 應回傳:content-type: image/jpeg

Caption 指南

實務建議

Caption 範例

caption = """Summer vibes are here! ☀️🌴

Swipe to see our new beachwear collection →

Shop now: link in bio

#summer #beachwear #fashion #ootd #style
@partnerbrand"""

疑難排解

常見錯誤

錯誤:「Account is not a Business account」

錯誤:「Media processing failed」

錯誤:「Video upload failed」

錯誤:「Token expired」

錯誤:「Carousel items must have same aspect ratio」

發佈流程

Instagram 的發佈流程包含以下階段:

  1. 建立容器:API 接收請求
  2. 上傳媒體:媒體檔案上傳至 Instagram
  3. 處理媒體:Instagram 處理檔案(影片需額外時間)
  4. 正式發佈:貼文出現在貼文牆

針對 Reels,處理時間可能需要 1-5 分鐘,Boring 會自動等待並重試。

最佳實務

1. 圖片品質

2. 文字策略

3. 內容應用

4. 發佈時機

5. 上線前測試

發佈歷史

在控制台查看 Instagram 的發佈紀錄:

  1. 登入 Boring 控制台
  2. 捲動至 「Recent Posts」 區塊
  3. 篩選平台為 Instagram

每筆紀錄包含:

速率限制

Instagram API 的速率限制為:

Boring 會自動處理速率限制,超出時會回傳相對應的錯誤訊息。

進階功能

多個 Instagram 帳號

可在同一個 Boring 帳號下管理多個 Instagram 商業帳號:

accounts = {
    "main_account": "account-id-1",
    "personal_brand": "account-id-2",
    "client_account": "account-id-3"
}

# 依據需求發佈到特定帳號
for name, account_id in accounts.items():
    post_data["post"]["accountId"] = account_id
    response = requests.post(API_URL, headers=headers, json=post_data)

內容調整

將其他平台的內容轉為適合 Instagram 的格式:

def adapt_for_instagram(content):
    # Instagram 偏好正方形或直式比例
    # Caption 調整為 Instagram 樣式
    return {
        "text": f"{content['text']}\n\n#instagram #hashtag",
        "mediaUrls": resize_for_instagram(content['mediaUrls']),
        "platform": "instagram"
    }

輪播規劃

在輪播貼文中安排有效的敘事節奏:

carousel_strategy = {
    "slide_1": "吸引目光的封面圖",
    "slide_2": "問題描述",
    "slide_3": "解方亮點",
    "slide_4": "產品細節",
    "slide_5": "行動呼籲"
}

Instagram Shopping

注意:目前 Boring API 尚未支援 Instagram Shopping(商品標記)。該功能需要 Instagram 額外核准與權限。

下一步