Skip to content

diewland/line-richmenu-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LINE Richmenu API

create LINE rich-menu from API

Example

import os
from pprint import pprint as pp

# init api
access_token = os.environ.get('LINE_ACCESS_TOKEN')
api = LINERichmenuAPI(access_token)

# sample user_id, menu config
user_id = '-----<LINE-USER-ID>-----'
config = {
    "size": {
      "width": 2500,
      "height": 1686
    },
    "selected": False,
    "name": "Nice richmenu",
    "chatBarText": "Tap here",
    "areas": [
      {
        "bounds": {
          "x": 0,
          "y": 0,
          "width": 2500,
          "height": 1686
        },
        "action": {
          "type":"message",
          "text":"Welcome rich-menu!"
        }
      }
    ]
}

# setup menu ( first time only )
api.remove_all_menus(True)
resp = api.create_menu(config, './sample.png')
menu_id = resp['richMenuId']

# link/unlink menu (per user) as much as you want
api.unlink_user_menu(user_id)
api.link_user_menu(user_id, menu_id)

# view script result
pp(api.list_menus())

Reference(s)

https://developers.line.me/en/docs/messaging-api/using-rich-menus/

About

create LINE rich-menu from API

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages