# Facebook Ads

#### 背景

用户可以集成facebook ads到appflow. 实现：

1. 获取facebook平台的广告投放成本（Spend on ads）

#### **如何配置appflow**

1. 在Settings板块，找到Applications，并编辑，打开的页面如下。

<figure><img src="/files/QVOH1p3sMzmV2lmosiTl" alt=""><figcaption></figcaption></figure>

2. 给facebook integrations填入 Access Token, 并Activate Integration开启功能。

<figure><img src="/files/Gygi6QRSXnwhyVkEJhIT" alt=""><figcaption></figcaption></figure>

#### 如何获取Access Token

1. 在FB建立开发者账户并创建APP ID，配置BM
2. 研发在产品接入FB的SDK
3. 在event manager 配置App后生成Data source
4. 在Data source的settings获取access token

**TODO: 因为没有相关的环境，无法进行配置截图，后续需要补充配置细节**

### 非开发者模式获取token

1. **在 BM → Users → System Users 新增 System User**
   * 角色选择 **Admin**
2. **为 System User 关联目标广告账户**
   * 进入 **Add Assets**
   * 赋予 `Advertiser` 或 `Manage Ad Account` 等权限
3. **生成长期访问令牌**
   1. 点击 **Generate New Token**
   2. 选择本应用
   3. 勾选权限：
      * `ads_read`
      * `ads_management`
      * `business_management`
   4. Token 有效期选择 **Never expires**
   5. 生成后复制并保存 Token

部分截图

1.创建一个admin类型system user

<figure><img src="/files/2Kf9615NZ44hD0D83wo1" alt=""><figcaption></figcaption></figure>

2.选择相关adcount Assign permissions\
![](/files/8pxqy524vYJufweL9DIu)

3.点击 **Generate New Token选择需要权**


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.appflow.ai/docs/facebook-ads.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
