Instagram 發佈
了解如何連結 Instagram 商業帳號,並發佈照片、輪播貼文與 Reels。
連結 Instagram 帳號
前置需求
- Instagram 商業或創作者帳號(個人帳號不支援)
- 已登入 Boring 控制台
注意:Instagram 授權流程採用 Instagram 原生 OAuth,不需要先連結 Facebook 粉絲專頁。
如何將個人帳號轉為商業帳號
若目前是個人帳號:
- 開啟 Instagram App
- 前往 設定 → 帳號
- 點擊 「切換到專業帳號」
- 選擇 Business 或 Creator
- 依指示完成設定
連結步驟
- 在控制台按下 「Connect Instagram」
- 如尚未登入 Instagram,請先登入
- 授權 Boring 存取你的 Instagram 帳號
- 授與所需權限:
instagram_business_basic:帳號基本資訊instagram_business_content_publish:發佈內容instagram_business_manage_comments:管理留言instagram_business_manage_messages:管理私訊
- 點擊 「Authorize」
完成後,帳號會顯示於「Authorized Accounts」列表,包含:
- Instagram 使用者名稱(例如:@yourusername)
- 帳號類型(BUSINESS、CREATOR 或 MEDIA_CREATOR)
- 平台標籤(Instagram)
- 唯一帳號 ID(可透過「Copy ID」複製)
- 解除連結選項
權杖資訊
- 權杖類型:長期使用者權杖
- 初始權杖:1 小時(短期)
- 自動轉換為:60 天(長期)
- 有效期限:從授權起算 60 天
- 自動刷新:需在到期前重新授權
重要:每 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 貼文牆上建立單張圖片貼文。
照片規格:
- 格式:JPG、PNG
- 最低解析度:320x320
- 最高解析度:1440x1440
- 長寬比:
- 正方形:1:1(建議)
- 橫式:1.91:1
- 直式:4:5
- 最大檔案大小:8MB
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"
}
}
}
效果:建立可左右滑動的輪播貼文。
輪播限制:
- 最少 2 張、最多 10 張
- 所有圖片必須使用相同長寬比
- 支援格式:JPG、PNG
- 其他規格同單張照片
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 規格:
- 影片長度:3-90 秒
- 解析度:1080x1920(9:16)
- 格式:MP4(H.264 Video + AAC Audio)
- 檔案大小:建議低於 100MB
- URL:必須可公開存取
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 對圖片品質要求嚴格:
最低條件:
- 解析度:320x320 像素
- 檔案大小:至少 1KB
建議標準:
- 解析度:1080x1080(正方形)或 1080x1350(長方形)
- 檔案大小:1-8MB
- 格式:JPG(PNG 允許,但可能被轉換)
- 色域:sRGB
影片規格
Reels 要求:
- 長度:3-90 秒
- 解析度:1080x1920(9:16)
- 格式:MP4
- 視訊編碼:H.264
- 音訊:AAC
- 位元率:建議 3500-5000 kbps
媒體託管
與 Facebook 規範相同,媒體 URL 必須:
- 可公開存取
- 指向實際檔案
- 使用 HTTPS 通訊協定
- 回傳正確的 content-type
發佈前測試 URL:
curl -I https://example.com/image.jpg
# 應回傳:content-type: image/jpeg
Caption 指南
實務建議
- 最大字數:2,200 字元
- Hashtag:建議 3-5 個(最多 30 個)
- Emoji:適度使用可提高互動
- 換行:使用
\n\n建立段落 - @mention:以 @username 標記相關帳號
- 前 125 字:最重要,會在「more」前顯示
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」
- 原因:連結的是個人帳號
- 解法:於 Instagram 設定將帳號轉為 Business 或 Creator
錯誤:「Media processing failed」
- 原因:圖片未符合要求
- 解法:
- 確認解析度至少 320x320
- 確保長寬比在允許範圍內
- 檔案為有效的 JPG/PNG
錯誤:「Video upload failed」
- 原因:影片格式或長度不符
- 解法:
- 轉換為 H.264 編碼的 MP4
- 影片長度控制在 3-90 秒
- 檔案大小低於 100MB
錯誤:「Token expired」
- 原因:60 天權杖已過期
- 解法:回控制台重新連結帳號
錯誤:「Carousel items must have same aspect ratio」
- 原因:輪播中的圖片長寬比不同
- 解法:重新調整圖片,全部採用相同的長寬比(例如 1:1)
發佈流程
Instagram 的發佈流程包含以下階段:
- 建立容器:API 接收請求
- 上傳媒體:媒體檔案上傳至 Instagram
- 處理媒體:Instagram 處理檔案(影片需額外時間)
- 正式發佈:貼文出現在貼文牆
針對 Reels,處理時間可能需要 1-5 分鐘,Boring 會自動等待並重試。
最佳實務
1. 圖片品質
- 使用高解析圖片(至少 1080x1080)
- 輪播貼文保持一致長寬比
- 控制檔案大小(1-3MB 最佳)
- 一般照片建議 JPG,透明圖形可用 PNG
2. 文字策略
- 重要資訊先寫在開頭 125 字內
- 使用換行提升可讀性
- 加入行動呼籲(Call to Action)
- 選用 3-5 個相關 Hashtag
- 標記合作夥伴或相關帳號
3. 內容應用
- 產品照片:使用輪播展示不同角度
- 教學內容:以 Reels 呈現分步驟影片
- 前後對比:使用輪播呈現差異
- 幕後花絮:用 Reels 增加真實感
4. 發佈時機
- 依 Instagram Insights 選擇高互動時段
- 維持固定發佈節奏
- 測試不同時間找出最適合的受眾時段
5. 上線前測試
- 先以單張照片確認流程
- 檢查所有 URL 是否可存取
- 事前預覽媒體
- 確認圖片長寬比一致
發佈歷史
在控制台查看 Instagram 的發佈紀錄:
- 登入 Boring 控制台
- 捲動至 「Recent Posts」 區塊
- 篩選平台為 Instagram
每筆紀錄包含:
- 貼文類型(photo、carousel、reels)
- Caption 摘要
- 發佈狀態(成功/失敗)
- 媒體 ID
- 時間戳記
速率限制
Instagram API 的速率限制為:
- 每位使用者:每小時 200 次呼叫
- 每個應用程式:每小時 4800 次呼叫
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 額外核准與權限。
下一步
- Facebook 發佈:了解 Facebook 發佈流程
- Threads 發佈:了解 Threads 發佈細節
- API 參考:查看完整 API 文件
- 程式範例:更多程式範例