message buttons not working on slack code example
Example: how to add button in slack in rasa
@slack_webhook.route("/webhook", methods=["GET", "POST"])
async def webhook(request: Request) -> HTTPResponse:
if request.form:
output = request.form
payload = json.loads(output["payload"][0])
if self._is_interactive_message(payload):
sender_id = payload["user"]["id"]
text = self._get_interactive_response(payload["actions"][0])
if text is not None:
out_channel = payload["channel"]["id"]
users = payload["user"]["id"]
metadata = {'out_channel': out_channel, 'users': users}
return await self.process_message(
request, on_new_message, text, sender_id, metadata
)
elif payload["actions"][0]["type"] == "button":
return response.text("User clicked link button")
return response.text(
"The input message could not be processed.", status=500
)