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:
# metadata = self.get_metadata(request)
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":
# link buttons don't have "value", don't send their clicks to bot
return response.text("User clicked link button")
return response.text(
"The input message could not be processed.", status=500
)