在這個步驟將學會如何使用 Discord 節點,將訊息傳送到 Discord 頻道。
完成這個步驟後,流程會長得像這樣:

現在已經計算出「已確認訂單」的總筆數與總金額,接下來要把這些資訊傳送到 Nathan 團隊的 Discord 頻道(#course-level-1)。
如果你使用的是其他通訊工具(例如 Slack 或 Mattermost),也可以使用對應的節點來取代 Discord 節點。
加入 Discord 節點(接在 Code 節點後面)
- 在 Code 節點右側點選「+」圖示
- 搜尋並加入 Discord 節點
- 在「Message Actions」分類中選擇「Send a message」

設定 Discord 節點參數
- Connection Type(連線方式):選擇 Webhook
- Credential for Discord Webhook(憑證):選擇「Create New Credential」
- 將你在註冊課程時收到的 Webhook URL 貼到憑證欄位中
- 點選「Save」儲存憑證,然後關閉憑證視窗
- Operation(操作):選擇 Send a Message
- Message(訊息內容):
- 點選右側的「Expression」標籤
- 貼上以下表達式:
This week we've {{$json["totalBooked"]}} booked orders with a total value of {{$json["bookedSum"]}}. My Unique ID: {{ $('HTTP Request').params["headerParameters"]["parameters"][0]["value"] }}
這段訊息在Discord頻道會顯示:
This week we've 16 booked orders with a total value of 123456. My Unique ID: abc123xyz

執行並查看結果
點選「Execute step」後,你應該會看到:
- n8n 中顯示 Discord 節點執行成功
- Discord 頻道 #course-level-1 中出現訊息

Discord 節點執行結果畫面
🖼 Discord 頻道訊息畫面











