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 :)
JavaScript
x
17
17
1
@flask.route("/slack_webhook")
2
def slack_webhook():
3
print("Slack Webhook.....!!!")
4
5
data = json.loads(request.data.decode("utf-8"))
6
if 'challenge' in data:
7
return(data['challenge'])
8
9
if data['type'] == 'event_callback':
10
response = make_response("", 200)
11
response.headers['X-Slack-No-Retry'] = 1
12
print("returning response")
13
return response
14
15
else:
16
slack_event_handler.delay(data)
17
Advertisement
Answer
directly return the status if successfully received required information.
JavaScript
1
2
1
return 'HTTP 200 OK'
2