Reputation: 63
I am trying to slack open.dialog method for some user input, the issue is once the user fill the field dialog box stays and throws error "We had some trouble connecting. Try again?"
I am using Django + restframework for command and dialog url.
I have tried sending empty body with 200 , but that did not work either.
return Response(data='',status=status.HTTP_200_OK)
def post(self, request, *args, **kwargs):
slack_message = request.data
payload = json.loads(slack_message.get('payload'))
channel = payload["channel"]["id"]
if payload['type'] == "dialog_submission":
return Response(status=status.HTTP_200_OK) # responding to slack with 200
# below is rest of the code which does not work.
if payload['token']==SLACK_VERIFICATION_TOKEN:
sc.api_call('chat.postMessage',
channel=channel,
text="we are working on your request , will update you shortly :)")
summary = payload["submission"]["summary"]
user_id = payload["user"]["id"]
Upvotes: 1
Views: 1420
Reputation: 1245
Try this:
return {"isBase64Encoded": True, "statusCode": 200, "headers": { }, "body": ""}
This worked for me.
Upvotes: 1
Reputation: 129
Try sending an HTTP 204, because that is a response with no content. It will work just fine.
Upvotes: 0