Giter VIP home page Giter VIP logo

check-in-machine's People

Contributors

barry800414 avatar mark86092 avatar

Watchers

 avatar  avatar

check-in-machine's Issues

How to create a messenger bot, Step by Step

1. 建立粉絲專頁

詳見官方文件

2. 新增一個 facebook 應用程式

  1. 進入 Facebook developer console,點選右上角,我的應用程式,新增應用程式
    2017-12-30 4 33 50

  2. 給這個 app 一個名字,並填寫聯絡 email
    2017-12-30 4 34 20

  3. 種類選 messenger
    2017-12-30 4 34 46

  4. 從左邊「產品」-> 「Messenger」可以進到設定頁。這邊是綁定這個 app 到粉絲專頁,產生權杖 (AccessToken)。
    2017-12-30 4 35 23

  5. 這邊要設定 webhook
    2017-12-30 4 35 35

  6. webhook 要放 bot server 的 url,以及驗證權杖 (verifyToken)。這邊的驗證權杖跟 accessToken 無關,可以自己取,可以亂數產生一個放進去。這個驗證權杖的目的是讓你的 bot server 不要隨便收到 request 就回應,而是看到這個 token 才回。
    下放註冊的事件中,請至少選取 messages & messages_postback
    2017-12-30 4 56 47

  7. 設定應用程式測試員
    左邊的「角色」點下去後,右邊可以設定不同角色,方便團隊夥伴做測試。在 App 還沒通過審查&設定公開之前,只有這些人可以測試你的 app 。
    2017-12-30 5 13 46

  8. 左邊的「主控版」點下去後,可以在右邊看到 appId (應用程式編號)& appSecret (這個 app 的密碼)
    2017-12-30 4 35 55

操作完以上的步驟後,你會拿到四個值,分別是:

  1. appId:應用程式編號
  2. appSecret:應用程式密鑰
  3. accessToken:綁定粉專的權杖
  4. verifyToken:bot server 驗證權杖

這四個值是建立 bot server 必須的,請務必保密,不要隨意放在不安全的地方。

3. 伺服器設置

  1. clone repository
git clone [email protected]:barry800414/check-in-machine.git

若使用 heroku server

  1. 如果你要使用 heroku server ,先把這個 Tutorial 玩一玩,你就會知道如何 deploy 你的 app 上去

  2. 使用 heroku mlab 的 add-on,就會有個 500 mb 的 mongodb 可以用

  3. https://dashboard.heroku.com/apps/:app-id/settings 頁面,把上述四個必要的值設定進去

4. 設定臉書粉絲專頁

先進到臉書粉絲專頁的「設定」頁面,左邊有個 Messenger 平台
2017-12-30 7 16 32

選由機器人自動回覆,下面則是把你的 facebook app 綁定成 primary receiver
2017-12-30 7 15 13

如果粉專要對外公開,記得在「一般」設定的地方,把臉書專頁設成公開!
2017-12-30 7 14 53

5. 送審核

facebook 在通過審核之前,都只有測試人員可以使用,所以記得送審核,才能對外發布。
進到 facebook developer console,進到你的 facebook app

左邊產品選 messenger
2017-12-30 7 20 31

往下捲可以看到這個區塊,選 pages_messages 新增到提交內容
2017-12-30 7 20 41

把詳細資訊打上去,就可以送出審核了
2017-12-30 7 20 54

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.