You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to send a message and quick-reply buttons should be displayed. I use this code:
qr = QuickReply(items=[
QuickReplyItem(action=Action(
label="Accept",
text="Accept",
type="message"),),
QuickReplyItem(action=Action(
label="Decline",
text="Decline",
type="message")),
])
message = TextMessage(
text="Please accept or decline",
quick_reply=qr)
pmr = PushMessageRequest(to=LINE_USER_ID, messages=[message])
print("PMR", pmr)
result = await line_bot_api.push_message(pmr)
Current Behavior
I get the following error message and the message is not sent via LINE.
HTTP response body: {"message":"The request body has 2 error(s)","details":[{"message":"must be specified","property":"messages[0].quickReply.items[0].action.text"},{"message":"must be specified","property":"messages[0].quickReply.items[1].action.text"}]}
It seems that the server complains, that the action of the quick-reply-item has no element "text".
The reason for this is that import linebot.v3.messaging.Action does not have this field.
Workaround
With the following monkey-patch, everything works fine:
import linebot.v3.messaging
class PatchedAction(linebot.v3.messaging.Action):
text: StrictStr
linebot.v3.messaging.Action = PatchedAction
System Informations
Expected Behavior
I want to send a message and quick-reply buttons should be displayed. I use this code:
Current Behavior
I get the following error message and the message is not sent via LINE.
It seems that the server complains, that the action of the quick-reply-item has no element "text".
The reason for this is that
import linebot.v3.messaging.Action
does not have this field.Workaround
With the following monkey-patch, everything works fine:
Suggested Change
Add the field
text
to the classAction
, so that it matches to the structure described here: https://developers.line.biz/en/docs/messaging-api/using-quick-reply/#set-quick-reply-buttonsThe text was updated successfully, but these errors were encountered: