Facebook 应用凭据#
¥Facebook App credentials
你可以使用以下凭据验证以下节点:
¥You can use these credentials to authenticate the following nodes:
Facebook Graph API credentials
如果你希望为 Facebook Graph API 节点创建凭据,请按照 Facebook Graph API 凭据 文档中的说明进行操作。
¥If you want to create credentials for the Facebook Graph API node, follow the instructions in the Facebook Graph API credentials documentation.
支持的身份验证方法#
¥Supported authentication methods
- 应用访问令牌
¥App access token
相关资源#
¥Related resources
有关服务的更多信息,请参阅 Meta 的 Graph API 文档。
¥Refer to Meta's Graph API documentation for more information about the service.
使用应用访问令牌#
¥Using app access token
要配置此凭据,你需要一个 面向开发者的 Meta 账户以及:
¥To configure this credential, you'll need a Meta for Developers account and:
- 应用访问令牌
¥An app Access Token
- 可选应用秘籍:用于验证有效负载的完整性和来源。
¥An optional App Secret: Used to verify the integrity and origin of the payload.
设置凭据共有五个步骤:
¥There are five steps in setting up your credential:
- 创建 Meta 应用 使用 Webhooks 产品。
¥Create a Meta app with the Webhooks product. 2. 生成应用访问令牌 用于该应用。
¥Generate an App Access Token for that app. 3. 配置 Facebook 触发器。
¥Configure the Facebook trigger. 4. 可选的:添加应用密钥。
¥Optional: Add an app secret. 5. 应用审核:仅当你的应用用户在应用本身上没有角色时才需要。如果你创建应用仅供内部使用,则无需执行此操作。
¥App Review: Only required if your app's users don't have roles on the app itself. If you're creating the app for your own internal purposes, this isn't necessary.
请参阅以下各步骤的详细说明。
¥Refer to the detailed instructions below for each step.
创建 Meta 应用#
¥Create a Meta app
要创建 Meta 应用:
¥To create a Meta app:
- 前往 Meta Developer 应用仪表盘,选择“创建应用”。
¥Go to the Meta Developer App Dashboard and select Create App. 2. 如果你有企业作品集,并且准备将应用连接到它,请选择企业作品集。如果你没有业务组合或尚未准备好将应用连接到业务组合,请选择“我暂时不想连接业务组合”,然后选择“下一步”。“用例”页面打开。
¥If you have a business portfolio and you're ready to connect the app to it, select the business portfolio. If you don't have a business portfolio or you're not ready to connect the app to the portfolio, select I don’t want to connect a business portfolio yet and select Next. The Use cases page opens. 3. 选择“其他”,然后选择“下一步”。
¥Select Other, then select Next. 4. 选择“业务”和“下一步”。
¥Select Business and Next. 5. 填写必要信息:
¥Complete the essential information:
-
添加应用名称
¥Add an App name.
-
添加一个应用联系人邮箱。
¥Add an App contact email.
-
你可以在此处连接到业务组合,也可以跳过。
¥Here again you can connect to a business portfolio or skip it. 6. 选择“创建应用”。
¥Select Create app. 7. “将产品添加到你的应用”页面打开。
¥The Add products to your app page opens. 8. 从左侧菜单中选择“应用设置”>“基本”。
¥Select App settings > Basic from the left menu. 9. 请输入隐私政策 URL。(安装应用 "直播中。" 的必要条件)
¥Enter a Privacy Policy URL. (Required to take the app "Live.") 10. 选择“保存更改”。
1 | |
-
在页面顶部,将应用模式从“开发”切换到“正式”。
¥At the top of the page, toggle the App Mode from Development to Live. 12. 在左侧菜单中,选择“添加产品”。
¥In the left menu, select Add Product. 13. “将产品添加到你的应用”页面出现。选择“Webhooks”。
¥The Add products to your app page appears. Select Webhooks. 14. Webhooks 产品打开。
¥The Webhooks product opens.
有关创建应用、必填字段(例如隐私政策 URL)以及添加产品的更多信息,请参阅 Meta 的 创建应用 文档。
¥Refer to Meta's Create an app documentation for more information on creating an app, required fields like the Privacy Policy URL, and adding products.
有关应用模式和切换到实时模式的更多信息,请参阅 应用模式 和 发布 | 应用类型。
¥For more information on the app modes and switching to Live mode, refer to App Modes and Publish | App Types.
生成应用访问令牌#
¥Generate an App Access Token
接下来,创建一个应用访问令牌,供你的 n8n 凭据和 Webhooks 产品使用:
¥Next, create an app access token to be used by your n8n credential and the Webhooks product:
- 在单独的标签页或窗口中打开 Graph API Explorer。
¥In a separate tab or window, open the Graph API explorer.
- 选择你刚刚在“访问令牌”部分创建的元应用。
¥Select the Meta App you just created in the Access Token section.
- 在“用户或页面”中,选择“获取应用令牌”。
¥In User or Page, select Get App Token.
- 选择“生成访问令牌”。
¥Select Generate Access Token.
- 页面提示你登录并授予访问权限。按照屏幕提示操作。
¥The page prompts you to log in and grant access. Follow the on-screen prompts.
App unavailable
1 | |
- 复制令牌并将其作为访问令牌输入到你的 n8n 凭据中。将此令牌也保存到其他位置,因为你需要在 Webhooks 配置中使用它。
¥Copy the token and enter it in your n8n credential as the Access Token. Save this token somewhere else, too, since you'll need it for the Webhooks configuration. 6. 保存 n8n 凭据。
¥Save your n8n credential.
请参阅 你的首次请求 文档的 Meta 说明,了解有关生成令牌的更多信息。
¥Refer to the Meta instructions for Your First Request for more information on generating the token.
配置 Facebook 触发器#
¥Configure the Facebook Trigger
既然你已经获得了令牌,就可以配置 Facebook 触发器节点:
¥Now that you have a token, you can configure the Facebook Trigger node:
- 在 Meta 应用中,从顶部导航栏复制应用 ID。
¥In your Meta app, copy the App ID from the top navigation bar. 2. 在 n8n 中,打开你的 Facebook 触发器节点。
¥In n8n, open your Facebook Trigger node. 3. 将应用 ID 粘贴到“应用 ID”字段中。
¥Paste the App ID into the APP ID field. 4. 选择“执行步骤”可将触发器切换到监听模式。
¥Select Execute step to shift the trigger into listening mode. 5. 返回到 Meta 应用 Webhooks 产品配置所在的选项卡或窗口。
¥Return to the tab or window where your Meta app's Webhooks product configuration is open. 6. 订阅你希望接收 Facebook 触发器通知的对象。每个订阅:
¥Subscribe to the objects you want to receive Facebook Trigger notifications about. For each subscription: 1. 从 n8n 复制 Webhook URL,并将其作为回调 URL 输入到你的 Meta 应用中。
1 | |
-
输入你上面复制的访问令牌作为验证令牌。
¥Enter the Access Token you copied above as the Verify token. 3. 选择“验证并保存”。(如果你的 n8n 触发器未监听,则此步骤将失败。)
¥Select Verify and save. (This step fails if you don't have your n8n trigger listening.) 4. 某些 Webhook 订阅(例如 User)会提示你订阅特定事件。订阅你感兴趣的事件。
¥Some webhook subscriptions, like User, prompt you to subscribe to individual events. Subscribe to the events you're interested in. 5. 你可以从 Meta 发送一些测试事件来确认功能是否正常运行。如果你发送测试事件,请在 n8n 中验证其是否已被接收。
¥You can send some Test events from Meta to confirm things are working. If you send a test event, verify its receipt in n8n.
请参阅 Facebook 触发节点 文档,了解更多信息。
¥Refer to the Facebook Trigger node documentation for more information.
可选的:添加应用密钥#
¥Optional: Add an App Secret
为了增强安全性,Meta 建议添加应用密钥。此步骤使用 appsecret_proof 参数对所有 API 调用进行签名。应用密钥证明是访问令牌的 SHA256 哈希值,使用你的应用密钥作为密钥。
¥For added security, Meta recommends adding an App Secret. This signs all API calls with the appsecret_proof parameter. The app secret proof is a sha256 hash of your access token, using your app secret as the key.
要生成应用密钥:
¥To generate an App Secret:
- 在 Meta 中查看你的应用时,从左侧菜单中选择“应用设置”>“基本”。
¥In Meta while viewing your app, select App settings > Basic from the left menu. 2. 选择“应用密钥”字段旁边的“显示”。
¥Select Show next to the App secret field. 3. 页面提示你重新输入 Facebook 账户凭据。完成上述操作后,Meta 将显示应用密钥。
¥The page prompts you to re-enter your Facebook account credentials. Once you do so, Meta shows the App Secret. 4. 选中它,复制它,然后将其作为应用密钥粘贴到你的 n8n 凭据中。
¥Highlight it to select it, copy it, and paste this into your n8n credential as the App Secret. 5. 保存 n8n 凭据。
¥Save your n8n credential.
更多信息,请参阅 应用密钥文档。
¥Refer to the App Secret documentation for more information.
应用审核#
¥App review
应用审核需要业务验证。
¥App Review requires Business Verification.
如果你的应用将由以下人群使用,则必须经过应用审核:
¥Your app must go through App Review if it will be used by someone who:
- 在应用本身中没有角色。
¥Doesn't have a role on the app itself.
- 在认领该应用的业务中没有角色。
¥Doesn't have a role in the Business that has claimed the app.
如果你的应用用户仅限于在应用本身拥有角色的用户,则无需进行应用审核。
¥If your only app users are users who have a role on the app itself, App Review isn't required.
作为应用审核流程的一部分,你可能需要申请 Webhook 订阅的高级访问权限。
¥As part of the App Review process, you may need to request advanced access for your webhook subscriptions.
更多信息请参阅 Meta 的 应用审核 和 高级访问 文档。
¥Refer to Meta's App Review and Advanced Access documentation for more information.
常见问题#
¥Common issues
未验证应用限制#
¥Unverified apps limit
Facebook 最多只允许你在 15 个尚未关联到 Meta 验证企业账户的应用上拥有开发者或管理员角色。
¥Facebook only lets you have a developer or administrator role on a maximum of 15 apps that aren't already linked to a Meta Verified Business Account.
如果超出限制,请参阅 限制 |创建应用。
¥Refer to Limitations | Create an app if you're over that limit.