|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Facebook API 为开发人员提供了以编程方式与 Facebook 平台进行交互的工具,以检索数据、发布内容、管理广告、分析受众洞察等等。

Many social media sites, like Facebook and X (formerly Twitter), now allow you to schedule posts in advance. However, it's still a tedious process that requires you to enter the posts one at a time. And if you have multiple accounts, you will need to log in and out of each one, which can be time-consuming. Another problem when trying to grow your social media account is the limited analytics provided by these sites.
许多社交媒体网站,例如 Facebook 和 X(以前称为 Twitter),现在允许您提前安排帖子。然而,这仍然是一个乏味的过程,需要您一次输入一个帖子。如果您有多个帐户,则需要登录和退出每个帐户,这可能非常耗时。尝试扩大社交媒体帐户时的另一个问题是这些网站提供的分析有限。
Fortunately, we can solve both of these problems using an API (Application Programming Interface) and a simple Python script or similar program.
幸运的是,我们可以使用 API(应用程序编程接口)和简单的 Python 脚本或类似程序来解决这两个问题。
Facebook offers a free API that works on both Facebook and Instagram, so keep reading while we explain how to get it and what you can do with it.
Facebook 提供了一个可在 Facebook 和 Instagram 上使用的免费 API,因此请继续阅读,我们会解释如何获取它以及可以用它做什么。
What is the Facebook API?
什么是 Facebook API?
The Facebook API provides developers with tools to interact with Facebook's platform programmatically. This allows you to retrieve data, post content, manage ads, analyze audience insights, and much more.
Facebook API 为开发人员提供了以编程方式与 Facebook 平台进行交互的工具。这使您可以检索数据、发布内容、管理广告、分析受众洞察等等。
Facebook's APIs include the Graph API, Marketing API, and specialized endpoints for various services like Messenger and Live Video. Right now, we are going to get the Graph API, but the others are acquired in the same way.
Facebook 的 API 包括 Graph API、Marketing API 以及用于 Messenger 和 Live Video 等各种服务的专用端点。现在,我们将获取 Graph API,但其他的也以同样的方式获取。
Steps to acquire the Facebook API
获取 Facebook API 的步骤
1. Create an app
1. 创建一个应用程序
Create a developer account at Meta for Developers (facebook.com).
在 Meta for Developers (facebook.com) 上创建一个开发者帐户。
Once you have an account, visit the Meta for Developers home page and select My Apps from the top right of the screen.
拥有帐户后,请访问 Meta for Developers 主页,然后从屏幕右上角选择“我的应用程序”。
The next screen will show you any apps you have already created, if any, and you should see a green Create App button that you want to click.
下一个屏幕将显示您已创建的所有应用程序(如果有),并且您应该会看到要单击的绿色“创建应用程序”按钮。
The next screen will ask you if you want to connect a business portfolio, or you can select – I don't want to connect a business portfolio yet.
下一个屏幕将询问您是否要连接业务组合,或者您可以选择 – 我还不想连接业务组合。
The next page has several options, but for now, we can select – Other.
下一页有几个选项,但现在我们可以选择 - 其他。
The next page will ask you to select an app type, and we can select – Business.
下一页会要求您选择应用程序类型,我们可以选择 – 商业。
On the next page, you will add an app name, enter an email, and choose – No business portfolio selected.
在下一页上,您将添加应用程序名称,输入电子邮件,然后选择 - 未选择业务组合。
Choose – Create app, then reenter your password.
选择 – 创建应用程序,然后重新输入您的密码。
You will now see a page that asks you to add products to your app. Choose – Instagram (which will work with Facebook) by clicking “Set up.”
您现在将看到一个页面,要求您将产品添加到您的应用程序。点击“设置”,选择 Instagram(可与 Facebook 配合使用)。
On the left side of the next screen, select – API setup with Facebook login. Then select “add product” to go back to the original screen.
在下一个屏幕的左侧,选择 – API 设置与 Facebook 登录。然后选择“添加产品”返回到原始屏幕。
Now you want to add Facebook Login for Business by clicking “Set up.” Then, “Save changes.”
现在,您想通过单击“设置”来添加 Facebook Login for Business。然后,“保存更改”。
2. Review app features
2.审查应用程序功能
After you create your app, you can review its features and permissions by selecting “App Review” on the left side of the screen and then choosing – Permissions and Features. Most have standard access, and we are going to leave them for our purposes, but you may need to change some of these to advanced access if a lot of people will be using the app. To use advanced access, you will need to verify your business.
创建应用程序后,您可以通过选择屏幕左侧的“应用程序审核”,然后选择 - 权限和功能来查看其功能和权限。大多数都具有标准访问权限,我们将保留它们用于我们的目的,但如果很多人将使用该应用程序,您可能需要将其中一些更改为高级访问权限。要使用高级访问权限,您需要验证您的业务。
3. Generate your access token
3. 生成您的访问令牌
You will need to enter the access token into your Python script or other coding project to make posts, look at stats, and more using the app we just created. To get the token, follow these steps:
您需要将访问令牌输入到 Python 脚本或其他编码项目中,以便使用我们刚刚创建的应用程序发布帖子、查看统计数据等。要获取令牌,请执行以下步骤:
Choose “Graph API Explorer” under “Tools” at the top of the page.
选择页面顶部“工具”下的“Graph API Explorer”。
Ensure that the app you just created is the “Meta App” on the right side of the screen.
确保您刚刚创建的应用程序是屏幕右侧的“元应用程序”。
Directly under that, you will need to add the permissions you want to use from the review app section. You can choose as many as you want by typing in the name or using the drop box, but for now, we'll just go with pages_show_list, Instagram_content_publish, and Instagram_basic. These are the things you will be able to do using your Python script or other code, so take time to go through them and get what you need.
在其正下方,您需要从评论应用程序部分添加您想要使用的权限。您可以通过输入名称或使用下拉框来选择任意数量的内容,但现在,我们只使用pages_show_list、Instagram_content_publish 和 Instagram_basic。这些是您可以使用 Python 脚本或其他代码执行的操作,因此请花一些时间浏览它们并获得您需要的内容。
When the permissions are selected, click – Generate Access Token
选择权限后,单击 – 生成访问令牌
Next, you will see a list of all of the pages the app can potentially access. If you have several, you can select them individually or choose “Opt in to all current and future Pages” to allow your app and scripts to access everything. After choosing, you will do the same for Instagram pages.
接下来,您将看到应用程序可以访问的所有页面的列表。如果您有多个页面,您可以单独选择它们或选择“选择加入所有当前和未来的页面”以允许您的应用程序和脚本访问所有内容。选择后,您将对 Instagram 页面执行相同的操作。
You will then review the app and click save.
然后,您将查看该应用程序并单击“保存”。
You will now see your access token near the top right of the screen, and you can copy it to use in your scripts. However, it only lasts a few hours before you'll need to regenerate it by clicking generate access token. To make it last about two months, copy the access token and open “Access Token Debugger” under “Tools” at the top of the page.
现在,您将在屏幕右上角附近看到您的访问令牌,您可以将其复制以在脚本中使用。但是,它只持续几个小时,然后您需要通过单击“生成访问令牌”来重新生成它。要使其持续大约两个月,请复制访问令牌并打开页面顶部“工具”下的“访问令牌调试器”。
Paste your token into the empty field on the new page and click – Debug
将您的令牌粘贴到新页面上的空白字段中,然后单击 – 调试
Next, click Extend Access Token for the new access token that you can use in your projects.
接下来,单击“扩展访问令牌”以获得可在项目中使用的新访问令牌。
YOU DID IT!
你做到了!
This guide is part of
本指南是
免责声明:info@kdj.com
所提供的信息并非交易建议。根据本文提供的信息进行的任何投资,kdj.com不承担任何责任。加密货币具有高波动性,强烈建议您深入研究后,谨慎投资!
如您认为本网站上使用的内容侵犯了您的版权,请立即联系我们(info@kdj.com),我们将及时删除。
-
- 稳定币市场风云变幻:USDC 资金外流,USDT 独大
- 2026-03-29 00:20:00
- 分析近期稳定币市场动态,重点关注 USDC 流出和 USDT 的持久主导地位,并对市场收缩和重新分配进行深入分析。
-
-
-
-
-
- 1 美元以下的加密代币正在流行:深入探讨市场推动者和推动者
- 2026-03-28 14:07:17
- 探索正在掀起波澜的 1 美元以下加密代币的动态世界。了解其上涨背后的催化剂及其对市场的意义。
-
-
-
- BlockDAG 在市场动态变化中应对钱包积累和价格漂移
- 2026-03-28 01:00:18
- BlockDAG 的固定定价策略与市场波动形成鲜明对比,因为投资者在价格波动中关注积累机会。

































