Интерактивная кнопка SLack с помощью django
Я пытаюсь использовать интерактивные кнопки из моего приложения django в slack но я сталкиваюсь с ошибкой Invalid_block вот так
{'ok': False, 'error': 'invalid_blocks_format'}
я не понимаю, почему я получаю эту ошибку. я отправляю данные в формате json, но все равно возникает ошибка
вот мой код на python
msg_to_other_channel = "<@%s> is on a short break and will be back in %s minutes "%(user,break_duration_admin)
msg_to_bot_channel = "Your short break started"
blocks = json.dumps(
"""
{
"text": "Would you like to play a game?",
"attachments": [
{
"text": "Choose a game to play",
"fallback": "You are unable to choose a game",
"callback_id": "wopr_game",
"color": "#3AA3E3",
"attachment_type": "default",
"actions": [
{
"name": "game",
"text": "Chess",
"type": "button",
"value": "chess"
},
{
"name": "game",
"text": "Falken's Maze",
"type": "button",
"value": "maze"
},
{
"name": "game",
"text": "Thermonuclear War",
"style": "danger",
"type": "button",
"value": "war",
"confirm": {
"title": "Are you sure?",
"text": "Wouldn't you prefer a good game of chess?",
"ok_text": "Yes",
"dismiss_text": "No"
}
}
]
}
]
}
"""
)
print(blocks)
# bot channel
Client.chat_postMessage(channel=channel, text=msg_to_bot_channel)
# other channel
Client.chat_postMessage(channel=other_channel, text=msg_to_other_channel)
# sending the button as well to this other channel
Client.chat_postMessage(channel=other_channel,text='test',blocks=blocks) <======