AI是否可能向用戶發送產品圖像

Describe the problem/error/question

I have a workflow in n8n where the first AI agent handles user questions like product price inquiries.
Now I want to make it smarter:
If the user asks for a product picture after getting the price,
a second AI agent should automatically send the product image to the Facebook Messenger user.
Is this possible to implement in n8n?
If yes, what would be the best approach for handling this flow between two agents and sending the image through Facebook Messenger API? and I am using Airtable for product information.
Thanks in advance!

What is the error message (if any)?

Please share your workflow

Share the output returned by the last node

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

@Abidul_Haque_Shohel 絕對可行,但兩個代理的拆分其實不是這個用例的正確模式 — 會增加延遲,並給你兩個故障點而不是一個。更簡潔的設置是單一 AI 代理輸出結構化 JSON,然後根據模型說它想做什麼在工作流中路由。流程最後是 Messenger Webhook → AI Agent → Switch on intent → Airtable lookup → Messenger Send API。

讓代理輸出這樣的內容:

{
  "intent": "image_request",
  "product_id": "rec123abc",
  "message_text": "here's the photo of the Black Cycle Pro you asked about"
}

然後 Switch on intent,根據 product_id 做 Airtable lookup 取得圖片 url,傳送到 Messenger。

有個很大的陷阱 — 自從前段時間的安全改變後,Airtable 的附件 url 是已簽名的,大約 2 小時後就會過期。如果你直接把 Airtable 的原始 url 傳給 Messenger,對於立即傳送是可以的,但當 Messenger 延遲加載圖片時簽名已經失效就會間歇性出問題。最簡潔的修復方法是先上傳到 Messenger 的 attachment_upload endpoint,取回永久的 attachment_id,然後在後續傳送中引用那個 id。更快的替代方案是重新託管在穩定的儲存空間(s3、cloudflare r2、supabase storage),並在 Airtable 中使用那個穩定的 url 而不是原生的附件欄位。

Messenger Send API 的圖片呼叫看起來像:

{
  "recipient": {"id": "<user_psid>"},
  "message": {
    "attachment": {
      "type": "image",
      "payload": {
        "url": "https://your-cdn/product-123.jpg",
        "is_reusable": true
      }
    }
  }
}

把 is_reusable 設為 true 會讓 FB 在伺服器端快取它,所以同一個產品圖片的重複傳送不會每次都重新下載,一旦你的目錄建立起來就能獲得大幅的延遲改善。

嗨,我是Jay,我是來自越南的n8n認證創作者。

我實際上建置並分享了一個免費工作流程,涵蓋了這個確切的使用案例:

使用Google Gemini建置Facebook Messenger客服AI聊天機器人

這是我發布的較為基礎的Messenger + AI工作流程之一,在短短2個月內達到約2,600次使用。這告訴我許多開發者正在嘗試解決同樣的問題。

在我的案例中,我用更簡單的架構處理它。與其將邏輯拆分到多個AI代理中,我強制單一AI代理返回具有三個字段的結構化JSON:textimagevideo

{

“text”: “Hello!”

“image”: “https://nguyenthieutoan.com/image.png

“video”: “https://nguyenthieutoan.com/video.mp4

}

有了這個設置,每當AI需要發送包含產品圖像或影片的回覆時,它只需要在一個回應中填入相關字段。這意味著單一代理可以在相同的執行中發送文本和多個媒體資產,這有助於降低延遲、讓工作流程保持更乾淨,並使將完整互動存儲在對話歷史中變得更容易。

你可能會發現這個方法對你的使用案例很有幫助。