/LineBOT

Primary LanguageGoOtherNOASSERTION

Line & Golang & Mongodb Example

Features

Before to start

  • Install docker
  • Needs to edit your userid in config/config.yaml
  • Create a line bot account with line developers
  • Enabled webhook and add the bot to your line account.
  • needs to edit channel_access_token and channel_secret in config.yaml

Installation

Create Mongodb docker

make init

Run development environment

make dev

Code build

make build

Usage

  1. After start the service,you can use ngrok to create a temporary link to use webhook in line developers.
  2. When verified succeed,you can use postman to use APIs from below.

API Usage

  • /line
    • Method:POST
    • When user type message to line bot,this api will be triggerred and stored message and user info to Mongodb.
  • /line/push
    • Method:POST
    • Line bot will push messages to specific user(use USERID)
  • /users/:userid/messages
    • Method:GET
    • Param:userid
    • query string :limit
    • It will use userid to find all messages from Mongodb and return records with limited number.