https://github.com/diewland/line-richmenu-api
create LINE rich-menu from API
https://github.com/diewland/line-richmenu-api
api line python richmenu
Last synced: 3 months ago
JSON representation
create LINE rich-menu from API
- Host: GitHub
- URL: https://github.com/diewland/line-richmenu-api
- Owner: diewland
- Created: 2018-02-23T07:56:04.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-08T00:53:06.000Z (over 2 years ago)
- Last Synced: 2025-01-12T06:26:08.823Z (5 months ago)
- Topics: api, line, python, richmenu
- Language: Python
- Size: 331 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# LINE Richmenu API
create LINE rich-menu from API### Example
```python
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 = '----------'
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/