facebook機器學習
by Paul Pinard
保羅·皮納德(Paul Pinard)
如何為您的頁面創建Facebook Messenger機器人 (How to create a Facebook messenger bot for your page)
When it comes to sharing your chatbot, Facebook Messenger is a must. We created a very easy step-by-step integration process for our platform users. Let’s dive in!
共享您的聊天機器人時,必須使用Facebook Messenger。 我們為平臺用戶創建了一個非常簡單的逐步集成過程。 讓我們潛入吧!
In fact, we realized many companies immediately put their bots on Facebook once in production, as it’s clearly the most user-friendly and easiest way for a customer to contact a company.
實際上,我們意識到許多公司在生產后立即將他們的機器人放到Facebook上,因為這顯然是客戶與公司聯系的最用戶友好和最簡單的方式。
A Facebook chatbot has a lot of advantages:
Facebook聊天機器人具有很多優點:
- 24/7 availability 24/7可用
- 100% answers 100%的答案
Instant answers (think about your Answer rate!)
即時答案(考慮您的答案率 !)
- Tedious tasks are automated 繁瑣的任務是自動化的
On the SAP Conversational AI platform, we created a step-by-step integration process for our users, so that it only takes a few minutes to reveal your chatbot to your Facebook followers. Let’s dive in!
在SAP Conversational AI平臺上,我們為用戶創建了逐步的集成過程,因此只需幾分鐘便可以向您的Facebook粉絲顯示您的聊天機器人。 讓我們潛入吧!
第1步:準備好聊天機器人 (Step 1: Get your chatbot ready)
First of all, you’ll need a chatbot (seems legit, right?!). Note that once your chatbot is online on Facebook, you’ll be able to modify it, and any changes you make to it will appear in your Messenger chat.
首先,您將需要一個聊天機器人(似乎合法,對吧?!)。 請注意,一旦聊天機器人在Facebook上在線,您就可以對其進行修改,并且您對它所做的任何更改都將顯示在Messenger聊天中。
For the purpose of this tutorial, we won’t go into how to create a chatbot. Instead, I warmly invite you to create your account (it’s completely free!) and read our tutorial.
就本教程而言,我們將不介紹如何創建聊天機器人。 相反,我熱烈邀請您創建您的帳戶 (它完全免費!)并閱讀我們的教程 。
Once your “joke-telling chatbot” (or whatever you’ve built) is ready, return here!
一旦您的“講笑話的聊天機器人”(或您所構建的任何東西)準備就緒,請回到這里!
步驟2:準備好您的Facebook頁面 (Step 2: Get your Facebook page ready)
Your chatbot will only be available for integration on a Facebook page (not on your personal profile). This means you have to create a Facebook page or have in mind the one you’ll use. Let’s assume your company, business, or group already has a page. (If that’s not the case, hit this link and create one.)
您的聊天機器人只能在Facebook頁面 (而不是您的個人資料)上集成。 這意味著您必須創建一個Facebook頁面,或者記住要使用的頁面。 假設您的公司,企業或組已經有一個頁面。 (如果不是這種情況,請點擊此鏈接并創建一個。)
As I said in the introduction, having a chatbot on a Facebook page will automate private messaging once it’s connected to your page. Thus, if you decide to remove the chatbot, you’ll immediately revert to traditional person-to-person conversations (which means nothing will happen when users enter a message until you manually answer them).
就像我在簡介中所說的那樣,在Facebook頁面上建立聊天機器人后,私人信息就會自動連接到您的頁面。 因此,如果您決定刪除聊天機器人,您將立即恢復為傳統的人對人對話(這意味著當用戶輸入消息之前,除非您手動回答,否則什么也不會發生)。
步驟3:建立Messenger Messenger應用程式 (Step 3: Create a Messenger Facebook app)
Creating an app will help make the connection between SAP Conversational AI and your Facebook page. Without this app, you won’t be able to publish your chatbot on your Facebook page.
創建一個應用程序將有助于使SAP Conversational AI與您的Facebook頁面之間建立連接 。 沒有該應用程序,您將無法在您的Facebook頁面上發布聊天機器人。
Click on this link, choose My Apps in the top menu and then Add New App.
點擊此鏈接,在頂部菜單中選擇我的應用程序 ,然后選擇添加新應用程序 。
Once your app is created, you’ll have to add a Messenger “product”.
創建應用程序后,您必須添加Messenger“產品”。
There are tons of jobs a Facebook app can be dedicated to, but we specifically want a private messaging application. Go to your app’s dashboard and click Set Up in the Messenger box.
Facebook應用程序可以完成很多工作,但是我們特別希望使用私人消息傳遞應用程序。 轉到應用的信息中心,然后在Messenger框中單擊“ 設置” 。
In the left-hand menu, you’ll then see Messenger under PRODUCTS.
在左側菜單中,您將在PRODUCTS下方看到Messenger 。
第4步:獲取頁面令牌和應用程序密碼 (Step 4: Get your page token and app secret)
Now that we’ve created a Messenger app, we need to link it to your Facebook page (by default, a Facebook app is an independent entity). With this connection, you’ll be given a token, which is basically a unique code that says “OK, this is the code of the Messenger app of the page X”.
現在我們已經創建了Messenger應用,我們需要將其鏈接到您的Facebook頁面(默認情況下,Facebook應用是一個獨立的實體)。 有了這個連接,您將獲得一個令牌,該令牌基本上是一個唯一的代碼,上面寫著“確定,這是X頁面的Messenger應用程序的代碼”。
In the left-hand menu, click Settings just below the product Messenger.
在左側菜單中,點擊產品Messenger下方的設置 。
Choose the page you want your chatbot to appear on.
選擇您希望聊天機器人出現的頁面。
For security reasons, you’ll probably need to allow the app to interact with your Facebook page. Click the blue Edit Permissions button, select your page, and check the different boxes.
出于安全原因,您可能需要允許該應用與您的Facebook頁面進行交互。 單擊藍色的“ 編輯權限”按鈕,選擇頁面,然后選中不同的框。
Once the permissions are given, a token will be generated.
授予權限后,將生成令牌。
Go back to the Connect tab in your SAP Conversational AI chatbot, choose Messenger, and paste your token in the Page token field in step 4.
返回到SAP Conversational AI聊天機器人中的“ 連接”選項卡,選擇“ 信使” ,然后在步驟4中將您的令牌粘貼到“ 頁面令牌”字段中。
Yay, we’re halfway through! Let’s now get our “app secret”, which is like a password for your app.
是的,我們已經過了一半! 現在,讓我們獲取“應用程序密碼”,就像您應用程序的密碼一樣。
In the left-hand menu, go to Settings > Basic.
在左側菜單中,轉到“設置 ” > 基本 。
For privacy, the app secret is hidden. Click Show and copy and paste it to the App secret field on your chatbot’s Connect tab (similar to what you just did with the page token).
為了保護隱私,應用程序的秘密被隱藏了。 單擊顯示并將其復制并粘貼到聊天機器人的“ 連接”選項卡上的“ 應用程序秘密”字段中(類似于您對頁面令牌所做的操作)。
Click Update channel under the SAP Conversational AI form.
單擊SAP Conversational AI表單下的Update channel 。
步驟5:將SAP Conversational AI連接到您的應用程序 (Step 5: Connect SAP Conversational AI to your app)
It’s time to connect our platform to Messenger!
現在是時候將我們的平臺連接到Messenger了!
On the Products > Messenger > Settings page, go to the Webhooks section and click Subscribe To Events.
對產品和克叔; 在Messen ger >“設置”頁面上,轉到“我們的下注”部分, 然后單擊“訂閱事件”。
In the pop-up window, enter the values for Callback URL and Verify token that you’ll find in step 4 of your chatbot’s Connect tab.
在彈出窗口中,輸入在聊天機器人的“ 連接”選項卡的第4步中將找到的“ 回調URL”和“ 驗證令牌”的值。
Also select the checkboxes shown below:
還要選擇下面顯示的復選框:
Once your page has reloaded, select your page in the list so that it can access your webhook.
頁面重新加載后,在列表中選擇頁面,以便它可以訪問您的Webhook。
步驟6:測試并發布Messenger Chatbot (Step 6: Test and publish the Messenger Chatbot)
Now you can test your bot as an administrator (you can also grant some test roles using Roles > Test Usersin the left-hand menu). Your bot won’t be publicly accessible until you change the status, so take your time to test it and make sure everything is just fine before releasing it to the world!
現在您可以以管理員身份測試您的漫游器 (也可以使用左側菜單中的Roles &g t; Test Uss來授予某些測試角色)。 在您更改狀態之前,您的機器人將無法公開訪問, 因此請對您的機器人進行測試,并確保在發布之前,一切正常!
Once you’re happy with your bot, if you change the toggle to ON (in the top right corner), you’ll be redirected to the settings and prompted to provide some extra information before your bot is published. (Tip: You can also access the settings under Settings > Basic in the left-hand menu.)
對機器人感到滿意后,如果將切換開關更改為ON (在右上角),則會將您重定向到設置,并提示您提供一些其他信息,然后再發布您的機器人。 (提示:也可以訪問下設置 &克叔設置;基本在左手菜單)。
Very last step: Facebook will want to verify and test your Messenger chatbot. Here’s what they say about this step in their documentation:
最后一步:Facebook將要驗證和測試您的Messenger聊天機器人。 他們在文檔中對這一步驟的評價如下:
“When you are ready to release your bot to the public, you must submit it to our team for review and approval. This review process allows us to ensure your Messenger bot abides by our policies and functions as expected before it is made available to everyone on Messenger.” — Facebook Documentation
“當您準備將機器人發布給公眾時,必須將其提交給我們的團隊進行審查和批準。 通過此審核過程,我們可以確保您的Messenger機器人在將其提供給Messenger上的所有人之前都遵守我們的政策和功能。 ” — Facebook文檔
In the left-hand menu, go to Products > Messenger > Settings and click Add to Submission in the pages_messaging block.
在左側菜單中,轉到產品 &g t; 單擊 Messen ger >設置 , 然后 在pages_mes saging塊中單擊Add to Submsion 。
It won’t take long for the Facebook review team to look at your bot and give you the green light to publish it!
Facebook審核團隊很快就可以看到您的機器人,并為您發布該機器人開了綠燈!
And that’s all there is to it!
這就是全部!
Hope you enjoyed this tutorial. And remember you’re very welcome to contact us if you need help, through the comment section below or via Stack Overflow.
希望您喜歡本教程。 并且請記住,如果需要幫助,請通過下面的評論部分或通過Stack Overflow與我們聯系。
Happy bot building ?
快樂的機器人大廈?
翻譯自: https://www.freecodecamp.org/news/how-to-create-a-facebook-messenger-bot-for-your-page-3be12ca18de5/
facebook機器學習