Skip to content

LinYunWen/FB-chatbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Facebook Messenger Chatbot

This is a messenger bot with KKBOX open API for searching songs, albums, playlist, artist data from KKBOX database You can use it for chat with "Innovation Chatbot" fans page on facebook

Setup

This project is runnable on Heroku!

Prerequisites

1. Create a Heroku app and Heroku postgres addon

$ cd /path/to/fb-chatbots

$ heroku create

# HEROKU_APPID is given to you from the above command. Run `heroku apps` to list them all.
$ heroku addons:create heroku-postgresql --app {HEROKU_APPID}

# URL_TO_HEROKU_APP is the URL given to you from the above command
$ heroku config:set APP_URL='https://{URL_TO_HEROKU_APP}'

2. Connect to the github or push to Heroku git

you can choose one method to do

3. Create a Facebook app

  • go to facebook developer and sign in
  • create a messanger app
  • you need to choose at least message and messaging_postbacks events

4. Get the Facebook fans page access token

  • see Token Generation section
  • slect which fans page to connect the bot
  • copy the page access token

5-1 Setup app webhook

  • click webhooks
  • click "edit subscription" button
  • set callback url with heroku app url
  • set verify token

5-2. Set environment variable

you need to set

  • ACCESS_TOKEN : fans page access token
  • AUTHORIZATION : KKbox account authorization
  • DATABASE_URL : your heroku postgres addon url
  • VERIFY_TOKEN : what you set on verify token
  • ADMIN_ID : administrator's conversation id

6. Deploy the project on Heroku

Usage

start chat with your fans page which set above on the messenger

    請輸入"/歌曲名稱"
    或輸入"#專輯名稱"
    或輸入"$歌單名稱"
    或輸入"@歌手名稱"

1. search track

input /[TRACK_NAME]

2. search album

input #[ALBUM_NAME]

3. search playlist

input $[PLAYLIST_NAME]

4. search artist

input @[ARTIST_NAME]

5. broadcast

input ![WHAT_YOU_WANT_TO_BROADCAST]

for only conversation id is ADMIN_ID and only broadcast to conversation id is in database

About

A meesenger chatbot for searching songs with KKBOX APIs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published