facebook机器学习
by Paul Pinard
保罗·皮纳德(Paul Pinard)
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聊天机器人具有很多优点:
Instant answers (think about your Answer rate!)
即时答案(考虑您的答案率 !)
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粉丝显示您的聊天机器人。 让我们潜入吧!
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!
一旦您的“讲笑话的聊天机器人”(或您所构建的任何东西)准备就绪,请回到这里!
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页面上建立聊天机器人后,私人信息就会自动连接到您的页面。 因此,如果您决定删除聊天机器人,您将立即恢复为传统的人对人对话(这意味着当用户输入消息之前,除非您手动回答,否则什么也不会发生)。
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 。
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 。
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。
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机器学习