I am working with slack event API. I am getting events on the subscribed events. But how to send respond using python requests. slack sends the same event back again after few seconds what json I need to send back to slack as a response to stop getting the same response? If you know the code, thank you so much in advance :)
@flask.route("/slack_webhook")
def slack_webhook():
print("Slack Webhook.....!!!")
data = json.loads(request.data.decode("utf-8"))
if 'challenge' in data:
return(data['challenge'])
if data['type'] == 'event_callback':
response = make_response("", 200)
response.headers['X-Slack-No-Retry'] = 1
print("returning response")
return response
else:
slack_event_handler.delay(data)
Advertisement
Answer
directly return the status if successfully received required information.
return 'HTTP 200 OK'