Answer the question
In order to leave comments, you need to log in
The bot does not send the keyboard, but gives an error. How to fix?
I decided to add a keyboard to the bot. Wrote a function that creates a keyboard skeleton:
def get_button(label, color, payload=""):
return {
"action": {
"type": "text",
"payload": json.dumps(payload),
"label": label
},
"color": color
}
keyboard = {
"one_time": True,
"Buttons": [
[
get_button(label="Кнопка 1", color="positive"),
get_button(label="Кнопка 2", color="positive"),
get_button(label="Кнопка 3", color="positive"),
get_button(label="Кнопка 4", color="negative"),
]
]
}
keyboard = json.dumps(keyboard, ensure_ascii=False).encode('utf-8')
keyboard = str(keyboard.decode('utf-8'))
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question