Stella Platform Documentation

Stella Platform Documentation

  • 文档
  • 标准设置程序
  • 参考
  • 常见问题
  • Bot API
  • 接口
  • Languages icon中文
    • English

›脸书

概览

  • 文档指南

开始使用

  • 介绍
  • 更新历程
  • 最佳实践
  • 聊天机器人范本

聊天机器人制作平台

  • 工作区域
  • 对话点
  • 附件ID

对话点资讯区

  • Tree ID和Composite ID
  • 基本资讯
  • 触发点
  • 响应
  • 执行动作
  • 重定向
  • 会员标记
  • 数据分析
  • 自然语言处理
  • 进阶

脸书

  • 消息类型
  • 按钮类型
  • 固定菜单
  • 访问令牌
  • 一次性通知
  • 多次通知 (测试版)

Instagram

  • 消息类型

WhatsApp

  • 概览
  • 设定步骤
  • 消息类型

网站聊天室插件

  • 概览
  • 消息类型
  • 按钮类型

微信

  • 消息类型

Slack

  • 消息类型

Telegram

  • 消息类型

集成

  • Dialogflow
  • Stripe
  • LUIS
  • 自定义收件箱集成

数据库

  • 数据库

媒体库

  • 媒体库

频道

  • 概览
  • 网络钩子
  • 频道元数据
  • 營業時間
  • 脸书
  • Instagram
  • 网站聊天室插件
  • WhatsApp
  • 微信
  • Slack(公共应用程式)
  • Slack(自定义应用程式)
  • Teamwork
  • Zendesk
  • 自定义平台

数据分析

  • 会员
  • 分析报表版
  • PSID

设定

  • 概览
  • 语言
  • 配对频道
  • 设置访问控制
  • 访问令牌
  • 追踪设置记录

聊天机器人推送平台

  • 推送内容
  • 目标受众
  • 数据分析

Log

  • 后台记录

访问令牌

If you are using your own Facebook App, you need to have a page access token to connect your Facebook page with Stella. Follow the steps to get a Long-Lived Page Access Token.

Add Permissions

  1. Go to Graph API explorer at https://developers.facebook.com/tools/explorer.

  2. Select your app in the Facebook App dropdown menu.

  1. Click the User or Page dropdown and select Get User Access Token.

  1. Login Facebook to continue.

  1. Choose the permissions you want to add to the App (manage_pages and publish_pages are necessary for the comment reply post).

On May 5, 2020, Facebook released six new Page permissions to replace the manage_pages and publish_pages permissions. The manage_pages permission has been replaced with pages_manage_ads, pages_manage_metadata, pages_read_engagement, and pages_read_user_content. The publish_pages permission has been replaced with pages_manage_posts and pages_manage_engagement
  1. The permissions will be added to the Permissions section and highlighted in green after selection. Click “Generate Access Token”.

  1. Login Facebook to grant access and subscribe the Pages to the App.
  1. The permissions will be shown in black after access is granted.

Get a Long-Lived User Access Token

  1. Replace the request with below information from your App.
  • graph-api-version: Get the latest Graph API Version from Facebook Documentation (https://developers.facebook.com/docs/facebook-login/access-tokens/refreshing#get-a-long-lived-page-access-token)
  • app-id: Find in the setting page of your App (https://developers.facebook.com/apps/)
  • app-secret: Find in the setting page of your App
  • your-access-token: Copy the access token after step 8 is completed
https://graph.facebook.com/{graph-api-version}/oauth/access_token?grant_type=fb_exchange_token&client_id={app-id}&client_secret={app-secret}&fb_exchange_token={your-access-token}

Sample request

https://graph.facebook.com/v7.0/oauth/access_token?grant_type=fb_exchange_token&client_id=6582005811111111&client_secret=80b242b5054b814b2911313&fb_exchange_token=EAAJWoUQZBX7UBAGwEHkPekYtwB3sZCOcRPqV1ZCTNr3VVZAIdx308zTUsXz613CaK9kvQrFwn6VgEqtsLGZAhEfVLjZCSkOiYZCSm93ZB7Dw6M7sU4FVMNG6H0i

  1. Copy the request and paste the link to a browser and press enter.

  1. You have got a Long-Lived User Access Token for getting a Long-Lived Page Access Token later.

Sample response

{"access_token":"EAAJWoUQZBX7UBAP21eOSh6dKOrXAbYmoNSovjU74fGQT3dGvLW6txhZAGj01of72VMr7ZAZAnUwFcSSbo1FpnnFEmgH1KvaFfwBITUgZBkuhaiusd28378hkjhagfqislk","token_type":"bearer","expires_in":5183283}

  1. Go to Access Token Debugger at https://developers.facebook.com/tools/debug/accesstoken/ and enter the access token to check for more details. Also copy the App-Scoped User ID for later use.

  1. Go back to the Graph API explorer and click Get Token drop down again and select your Page. This will exchange your User access token for a Page access token.

  1. Use the API call on the left panel. Select “GET” and submit me/subscribed_apps to check for current subscriptions. If there is no “feed” in “subscribed_fields”, please continue the following steps. If there is ”feed” in the selected page, you could use the comment post on that page.

Remarks: Please repeat steps 13 and 14 to check the current subscriptions for each page.

Sample API response

{
  "data": [
    {
      "link": "https://stella.sanuker.com/botBuilder",
      "name": "Chatbot",
      "id": "71161167223443",
      "subscribed_fields": [
        "messages",
        "messaging_postbacks",
        "messaging_optins",
        "message_deliveries",
        "message_reads",
        "messaging_account_linking",
        "messaging_referrals",
        "standby",
        "messaging_handovers"
      ]
    }
  ]
}
  1. Add the subscription to page by copying the existing “subscribed_fields” and adding “feed” using the below format.
feed,messages,messaging_postbacks,messaging_optins,message_deliveries,message_reads,messaging_account_linking,messaging_referrals,standby,messaging_handovers
  1. Use the API call in the left panel. Select “POST” and submit me/subscribed_apps?subscribed_fields=(the existing subscribed_fields+feed).

me/subscribed_apps?subscribed_fields=feed,messages,messaging_postbacks,messaging_optins,message_deliveries,message_reads,messaging_account_linking,messaging_referrals,standby,messaging_handovers
  1. API will return success after submission.

  1. Call GET me/subscribed_apps again to confirm your page subscription, "subscribed_fields" now should contain “feed”.

Sample API response

{
  "data": [
    {
      "link": "https://stella.sanuker.com/botBuilder",
      "name": "Chatbot",
      "id": "711611672717008",
      "subscribed_fields": [
        "feed",
        "messages",
        "messaging_postbacks",
        "messaging_optins",
        "message_deliveries",
        "message_reads",
        "messaging_account_linking",
        "messaging_referrals",
        "standby",
        "messaging_handovers"
      ]
    }
  ]
}

Get a Long-Lived Page Access Token

  1. Replace the request with below information from your App.
  • graph-api-version: Get the latest Graph API Version from Facebook Documentation (https://developers.facebook.com/docs/facebook-login/access-tokens/refreshing#get-a-long-lived-page-access-token)
  • user-id: Copy the App-Scoped User ID from step 12
  • long-lived-user-access-token: Copy the access token from step 11
https://graph.facebook.com/{graph-api-version}/{user-id}/accounts?
  access_token={long-lived-user-access-token}

Sample request

https://graph.facebook.com/v7.0/101634300234343443/accounts?access_token=EAAJWoUQZBX7UBAP21eOSh6dKOrXAbYmoNSovjU74fGQT3dGvLW6txhZAGj01of72VMr7ZAZAnUwFcSSbo1FpnnFEmgH1KvaFfwBITUgZBs8sZCpAPjusg7d3bde7gf82if78u3daf38fjfb6vejnv9enc

  1. Copy the request and paste the link to the browser and press enter. You have got a Long-Lived Page Access Token for connecting the Facebook page to Stella.

Sample response

{
   "data": [
      {
         "access_token": "EAAJWoUQZBX7UBAOjvHEupUAk7GxoEHIFNm9ldwMExpwxO7OQSwisGPtvLyKnl040pBZAbhR62TKMxsZAhPx8pwzmMMzX0yeHOjxcWaxz0WUyZA03sxUnlqlPkjhasd73hdjkh82hd8dh7dgfl19",
         "category": "E-commerce website",
         "category_list": [
            {
               "id": "1756049*******",
               "name": "E-commerce website"
            }
         ],
         "name": "Testing Page",
         "id": "11079******",
         "tasks": [
            "ANALYZE",
            "ADVERTISE",
            "MODERATE",
            "CREATE_CONTENT",
            "MANAGE"
         ]
      }
   ],
   "paging": {
      "cursors": {
         "before": "MTEwNzk2NDI3MjE0NDA5",
         "after": "MTEwNzk2NDI3MjE0NDA5"
      }
   }
}
  1. Go to Access Token Debugger at https://developers.facebook.com/tools/debug/accesstoken/ and enter the access token to check for more details.

The Type is “Page”, the Expires field should be “Never” and the Valid is “True”. Copy the full access token and update the access token in the Channel of Stella botbuilder.

  1. You could now build your comment reply post in your page! 🎉🎉

All access tokens may become invalid before they expire even non-expiring Page access tokens under certain circumstances. If a password changes, if the user who requested the token no longer has a role on the app or Page, or when a security issue has been detected, an access token will become invalid.

You could check the expiry date and the validity of an access token in the Access Token Debugger at https://developers.facebook.com/tools/debug/accesstoken/

← 固定菜单一次性通知 →
  • Add Permissions
  • Get a Long-Lived User Access Token
  • Get a Long-Lived Page Access Token
Stella Platform Documentation
Docs
Get StartedBot API ReferenceAPI ReferenceStandard Procedures
Community
FAQUser ShowcaseChat with Us
Copyright © 2023 Sanuker Inc. Limited