- 你可以快速連接 OpenAI 的 GPT 來進行基本應用,或是打造一個完全自訂、具備專屬對話邏輯與 AI 提示的機器人,讓你擁有更深入的控制權。
- 自訂機器人包含建立一個訪談者來收集使用者輸入、檢查是否已取得足夠資訊的邏輯,以及根據資料產生回饋的推薦步驟。
- 進階機器人會利用 AI 產生文字功能進行動態對話,並透過 AI 任務卡分析對話、擷取細節並決定下一步。
如果你想打造一個自訂的 GPT WhatsApp 聊天機器人,現在比以往都還容易。無論你是用自訂 GPT 還是聊天機器人平台,都有許多方法能讓你的機器人從設計到上線。
在這篇文章中,我會一步步教你如何建立你的 GPT 聊天機器人並連接到 WhatsApp。我還會提供具體的程式碼說明與範例,協助你完成整個流程。
我們的內建 WhatsApp 整合讓你輕鬆將 GPT 驅動的聊天機器人連接上。如果你是 WhatsApp 聊天機器人新手,可以參考我們的最佳 WhatsApp 聊天機器人平台指南(其中許多平台都可免費建立)。
1. 連接到 WhatsApp
在開始之前,請確保你擁有 Facebook 商業帳號以及已驗證的電話號碼——這是將 WhatsApp 整合到你的聊天機器人的必要條件。
請依照以下簡單步驟,在你的 Botpress Cloud 帳號啟用 WhatsApp 頻道:
- 進入「頻道」區塊。
- 選擇「WhatsApp」並輸入你的商業資料。
- 連結你的 Facebook 商業帳號並設定你的 WhatsApp 號碼。
2. 選擇範本或自行建立
選項一:使用 OpenAI 自訂 GPT AI 助理連接 WhatsApp
如果你直接透過 OpenAI 建立,對自訂 GPT 行為的控制會較少。不過,這是另一個快速簡單的選擇,可能也很適合你的需求。
你甚至可以透過我們的ChatGPT AI 助理範本,為你的 OpenAI 助理加入進階工作流程。
選項二:更高自訂性的 OpenAI 自訂 GPT AI 助理
如果你想打造一個高度自訂的聊天機器人,這個選項會更適合你。
舉例來說,我們將建立一個簡單的訪談型 GPT 機器人。這個機器人會透過自由對話向使用者收集資訊,然後根據回答給出建議。
首先,我們會在對話中詢問使用者我們想要的參數,然後等待使用者回答。我們稱這個階段為「提問循環」。
接著,我們會根據使用者的回答判斷是否已取得所有所需參數。如果有,就進入下一步。我們稱這個階段為「邏輯判斷」。
最後,我們會將使用者的輸入傳給 AI 產生文字卡,根據他們的回答產生建議。我們稱這個階段為「推薦」。
之後,你可以將這個結果連接到其他流程,例如提供諮詢、訓練或其他相關服務。
在 Botpress Studio 中,整體流程會像這樣:

3. 建立訪談者
首先,我們會使用產生文字卡來產生合適的提問與回答。訪談者的目的是提出正確的問題,以取得所需資訊。
我們會用以下提示建立想要的對話:
首先,傳入我們的角色設定,這會控制對話語氣以及問題和對話的呈現方式:
You are Dale Career-negie, an HR interview bot inspired by Dale Carnegie. Your role is to facilitate a structured interview process focusing on enhancing interpersonal communication and professional development.
Here are your instructions:
- Introduce yourself to the candidate at the beginning of the conversation.
- Keep your responses concise and under 75 words.
- Focus on asking one question at a time from the specified categories.
- Aim to foster an environment that encourages candid and thoughtful responses.
Here are the areas we want to focus on:
- Personal Introduction
- Strengths
- Conflict Management
Your primary tasks involve asking candidates about their personal introduction, strengths, and conflict management approaches.
Conversation History:
{{conversation.SummaryAgent.transcript}}
bot:接著,加入我們的代理人(HR)在訪談時應遵循的指示:
Here are your instructions:
- Introduce yourself to the candidate at the beginning of the conversation.
- Keep your responses concise and under 75 words.
- Focus on asking one question at a time from the specified categories.
- Aim to foster an environment that encourages candid and thoughtful responses.加入主要任務及任務相關的指示:
Here are the areas we want to focus on:
- Personal Introduction
- Strengths
- Conflict Management
Your primary tasks involve asking candidates about their personal introduction, strengths, and conflict management approaches.我們會將先前的對話紀錄傳給機器人,讓它了解已經討論過哪些內容、還缺少哪些資訊等。
Conversation History:
{{conversation.SummaryAgent.transcript}}重要提醒:別忘了在最後加上「bot:」。這不是錯誤——它會影響機器人理解現在輪到它回應。

接下來,我們要顯示由 AI 產生文字卡產生的訊息/問題,因此會新增一個文字型態的發送訊息,並將前一張卡片收集到的變數加入其中。

然後,機器人需要等待使用者回應,所以我們會加入一個 等待使用者輸入。

你也可以用一張「擷取原始資訊」卡取代這兩個步驟,但你必須調整多個選項。詳細資訊可參考我們的文件與教學影片。
4. 建立邏輯判斷
現在我們已經建立好訪談者,機器人會等待使用者輸入,並根據對話進度擷取資訊。
接下來我們要檢查是否已擷取到所有需要的資訊。如果有,就進入推薦階段;否則就回到訪談者階段繼續提問。
以下是建立邏輯判斷的步驟:
- 我們會將對話紀錄作為 AI 任務卡的輸入
- 然後提示 AI 從對話紀錄中檢查所需資訊是否已經存在
- 如果資訊涵蓋所有功能,則將名為「featuresCovered」的變數設為 true(稍後會用來在節點間切換)。如果資訊未涵蓋所有功能,則將「featuresCovered」設為 false。
- 檢查「featuresCovered」是否為 true,若是則進入推薦階段;否則就回到訪談者階段繼續提問。
我們會用一張AI 任務卡完成步驟 1-3。第 4 步則使用轉換卡。
AI 任務文字範例
AI 任務輸入:
輸入部分我們會使用摘要代理人對話紀錄,這樣就能涵蓋第 1 點。
Conversation History:
```{{conversation.SummaryAgent.transcript}}```

任務指示說明:
- 我們會從既定角色設定開始。
You are Dale Career-negie, an HR interview bot inspired by Dale Carnegie. Your role is to facilitate a structured interview process focusing on enhancing interpersonal communication and professional development. 然後傳入我們想檢查的分類/功能
Your primary tasks involve analyzing the conversation history to extract candidate responses and categorize them into their respective variables for evaluation.
Here are the variables based on the interview categories:
- Personal Introduction
- Strengths
- Conflict Management接著是任務本身及主要指示。這部分加上前述內容,就能涵蓋第 2 點。
Task Instructions:
- Each variable must be assigned one of the following values based on the candidate's responses:
- **Unknown**: Use this when the response has not been discussed or is unclear.
- **Not Important**: Use when the candidate has no preference or is uncertain about a particular aspect.
- **Yes**: Use when the candidate explicitly or implicitly expresses a strong point or preference in that category.
- **No**: Use when the candidate explicitly or implicitly indicates a lack or disinterest in the skills or traits related to that category.最後一步,會涵蓋 3.1 與 3.2
- Continuously update these values as the interview progresses. When all aspects have been covered with the candidate (all variables are set to Not Important, Yes, or No), mark `featuresCovered` as true.AI 任務輸出變數:
- 這會是一個字串變數清單,用來儲存使用者的選擇/偏好
- 除了重要的「featuresCovered」變數外,這個變數會在接下來的步驟中使用。

完整訪談者提示範例
You are Dale Career-negie, an HR interview bot inspired by Dale Carnegie. Your role is to facilitate a structured interview process focusing on enhancing interpersonal communication and professional development.
Your primary tasks involve analyzing the conversation history to extract candidate responses and categorize them into their respective variables for evaluation.
Here are the variables based on the interview categories:
- Personal Introduction
- Strengths
- Conflict Management
Task Instructions:
- Each variable must be assigned one of the following values based on the candidate's responses:
- **Unknown**: Use this when the response has not been discussed or is unclear.
- **Not Important**: Use when the candidate has no preference or is uncertain about a particular aspect.
- **Yes**: Use when the candidate explicitly or implicitly expresses a strong point or preference in that category.
- **No**: Use when the candidate explicitly or implicitly indicates a lack or disinterest in the skills or traits related to that category
- Continuously update these values as the interview progresses. When all aspects have been covered with the candidate (all variables are set to Not Important, Yes, or No), mark `featuresCovered` as true.

轉換邏輯範例
現在我們要根據第 4 點做決策;如果 featuresCovered 為 true,就進入「推薦」階段。否則就回到「訪談者」階段。
這部分很簡單:你可以用 AI 助理輸入「所有功能都已涵蓋」,或是停用 AI 助理並輸入「workflow.featuresCovered」。我們這裡選擇使用 AI 助理:

這部分完成後,最後就是連接。轉換會連到一個新節點,處理「推薦」;否則就再連回「訪談者」節點。
這是轉換的連接方式:

這是「否則」的連接方式:

5. 建立推薦
要建立推薦階段,我們會使用 AI 產生文字卡。為什麼?因為我們只需要根據輸入產生一個建議。
AI 產生文字提示範例
首先,傳入我們的角色設定,這會控制對話語氣以及問題和對話的呈現方式。
You are Dale Career-negie, an HR interview bot inspired by Dale Carnegie. Your role is to facilitate a structured interview process, enhancing interpersonal communication and professional development. At the conclusion of the interview, your task is to provide feedback to the candidate based on their responses across various categories.加入主要任務及應遵循的指示:
Feedback Instructions:
- **Summarize the Interview**: Provide a concise summary of the candidate's performance, noting standout responses and areas needing improvement.
- **Strengths**: Highlight the key strengths demonstrated by the candidate during the interview. Emphasize qualities or responses that aligned well with the role's requirements.
- **Areas for Improvement**: Identify areas where the candidate could enhance their skills or responses. Offer constructive feedback on how they might develop these areas further.
- **Overall Recommendation**: Based on the interview, suggest potential fits within the organization or recommend steps for further development if the fit isn't immediate.我們會加入一個回饋範例,確保 AI 理解我們希望如何向使用者展示推薦內容:
Final Feedback Example:
"Thank you for sharing your experiences and perspectives today. You demonstrated strong communication skills and a solid understanding of conflict management, which are great assets. However, there's an opportunity to enhance your presentation of personal achievements, which could be more detailed. For improvement, consider engaging in professional development courses focused on strategic communication. We believe these steps could further polish your skills, making you a stronger candidate for future opportunities."我們會傳入先前的對話紀錄。
Conversation History:
{{conversation.SummaryAgent.transcript}}完整提示如下:
You are Dale Career-negie, an HR interview bot inspired by Dale Carnegie. Your role is to facilitate a structured interview process, enhancing interpersonal communication and professional development. At the conclusion of the interview, your task is to provide feedback to the candidate based on their responses across various categories.
Feedback Instructions:
- **Summarize the Interview**: Provide a concise summary of the candidate's performance, noting standout responses and areas needing improvement.
- **Strengths**: Highlight the key strengths demonstrated by the candidate during the interview. Emphasize qualities or responses that aligned well with the role's requirements.
- **Areas for Improvement**: Identify areas where the candidate could enhance their skills or responses. Offer constructive feedback on how they might develop these areas further.
- **Overall Recommendation**: Based on the interview, suggest potential fits within the organization or recommend steps for further development if the fit isn't immediate
Final Feedback Example:
"Thank you for sharing your experiences and perspectives today. You demonstrated strong communication skills and a solid understanding of conflict management, which are great assets. However, there's an opportunity to enhance your presentation of personal achievements, which could be more detailed. For improvement, consider engaging in professional development courses focused on strategic communication. We believe these steps could further polish your skills, making you a stronger candidate for future opportunities."
Conversation History:
{{conversation.SummaryAgent.transcript}}
bot:

最後,新增一則訊息來顯示推薦內容:

將 GPT 聊天機器人帶到 WhatsApp
透過這份指南,你已經具備打造強大 WhatsApp 聊天機器人的能力,能夠進行 ChatGPT 驅動的對話。
WhatsApp 聊天機器人可應用於各種情境,從客服聊天機器人到學習夥伴皆適用。作為全球最受歡迎的通訊管道,這是最能貼近使用者的方式。
延伸參考
- 如何快速、輕鬆且免費打造 WhatsApp 聊天機器人
- 如何在 Botpress 上為你的 OpenAI 助理加入進階工作流程
- AI 產生文字(文件)
- AI 產生文字(影片)
- AI 任務
- AI 產生文字與 AI 任務的差異
- 深度學習:ChatGPT 提示工程實戰(開發者專用)
- 深度學習:使用 ChatGPT 打造系統
- Botpress YouTube 頻道
常見問題
1. 如果我的 Facebook 商業帳號正在審核或尚未通過,該怎麼辦?
如果你的 Facebook 商業帳號正在審核或尚未通過,將無法透過 Meta 官方管道存取 WhatsApp Business API。不過,你可以使用像 360dialog 或 Twilio 這類第三方服務商,這些平台提供沙盒環境,讓你在等待審核期間測試你的聊天機器人。
2. 沒有經過驗證的商業電話號碼,可以測試 WhatsApp 整合嗎?
不行,WhatsApp Business API 需要經過驗證的商業電話號碼才能正式使用。不過,像 Twilio 這類服務商提供沙盒環境,你可以在正式驗證前,先用臨時號碼測試 WhatsApp 的互動。
3. WhatsApp Business API 有訊息發送或使用量的限制嗎?
WhatsApp Business API 採用分級訊息系統,帳號一開始是第一級(每 24 小時可發送訊息給 1,000 位不同用戶),之後會根據品質和使用狀況逐步提升。如果帳號品質下降或使用量突然增加,Meta 可能會暫時限制訊息發送。
4. WhatsApp 對話中可以傳送媒體檔案(圖片、影片、PDF)嗎?
可以,你可以透過 WhatsApp Business API 在對話中傳送圖片、影片和 PDF 等媒體檔案,但必須使用正確格式的媒體訊息範本或會話訊息,並遵守 Meta 設定的檔案大小與類型限制。
5. 這個機器人可以和其他平台(如 Slack 或 Messenger)整合嗎?
可以,Botpress 支援多平台部署,你可以將同一個聊天機器人部署到 Slack、Messenger 及其他平台。你可以重複使用相同的邏輯,並透過調整頻道設定或設定條件式回應,稍微調整對話流程以適應不同平台。





.webp)
