2020/03/24

linebotでerror_response={"(関数名)": [{"message": "must not be longer than 60 characters"

app[scheduler.9381]:     line_bot_api.push_message(user_id, messages=messages)
app[scheduler.9381]:   File "/app/.heroku/python/lib/python3.6/site-packages/linebot/api.py", line 141, in push_message
app[scheduler.9381]:     '/v2/bot/message/push', data=json.dumps(data), timeout=timeoutapp[scheduler.9381]:   File "/app/.heroku/python/lib/python3.6/site-packages/linebot/api.py", line 1062, in _postapp[scheduler.9381]:     self.__check_error(response)app[scheduler.9381]:   File "/app/.heroku/python/lib/python3.6/site-packages/linebot/api.py", line 1088, in __check_errorapp[scheduler.9381]:     error=Error.new_from_json_dict(response.json)
app[scheduler.9381]: linebot.exceptions.LineBotApiError: LineBotApiError: status_code=400, request_id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, error_response={"details": [{"message": "must not be longer than 60 characters", "property": "template/text"}], "message": "A message (messages[0])\u00a0in the request body is invalid"}, headers={'Server': 'nginx', 'Content-Type': 'application/json', 'x-line-request-id': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', 'x-content-type-options': 'nosniff', 'x-xss-protection': '1; mode=block', 'x-frame-options': 'DENY', 'Content-Length': '160', 'Expires': 'Tue, xx xxx 2020 xx:xx:xx GMT', 'Cache-Control': 'max-age=0, no-cache, no-store', 'Pragma': 'no-cache', 'Date': 'Tue, xx xxx 2020 xx:xx:xx GMT', 'Connection': 'close'}
heroku[scheduler.9381]: State changed from up to complete
heroku[scheduler.9381]: Process exited with status 1

line_bot_api.push_message(user_id, messages=messages)で送信するメッセージが長すぎる。ButtonsTemplateで画像やタイトルを指定した場合、60文字までしか送信できない。