GithubHelp home page GithubHelp logo

go-line-bot's Introduction

Go LINE Bot

這是一個使用 Go 語言串接 LINE Messaging API 與 MongoDB 的範例程式

把聊天機器人加入好友並開始對話後,對話內容便會存到 MongoDB 中,並提供完整 CRUD APIs 操作資料庫

line-bot-demo

使用方式

  1. 啟動 MongoDB 服務
docker run --name mongo -d -p 27017:27017 mongo:4.4
  1. 在根目錄下新增 /chat/app/setting.yml ,並將 channel secret 與 channel access token 填入 (此程式會使用 Viper 讀取,secret 自 LINE Developer 取得)
channel_secret: "YOUR_CHANNEL_SECRET"
channel_access_token: "YOUR_CHANNEL_ACCESS_TOKEN"
  1. 啟動程式
cd cmd/line_bot && go run main.go
  1. 啟動 ngrok 反向代理,並將 URL 貼到 LINE Developer Console 中,註冊 Webhook
ngrok http 8080
  1. 加入使用 secret 與 access token 的 channel 好友,開始傳送訊息

參考資料

go-line-bot's People

Contributors

yihsuanhung avatar

Watchers

 avatar

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.