1

I created a bot in AWS Lex and I am trying to integrate it with Slack. I created a Slack app and followed the documentation as mentioned in-

https://docs.aws.amazon.com/lex/latest/dg/slack-bot-association.html

However, while trying to integrate with the Lex Postback URL I get an error saying

Your URL didn't respond with the value of the challenge parameter.
Our Request:
POST
"body": { 
     "type": "url_verification",
     "token": "VbODUleNdk2hieCvDwlScrQF",
     "challenge": "HRUXnK6YYLpx5U1s9AiADZgA0BAhWuTzfjAAzLEJIw1zz4GfuMAb"
}
Your Response:
"code": 200
"error": "challenge_failed"
"body": {

}

Per my knowledge, Lex by default should provide the response. Am I doing something wrong here? Any leads will help.

Thanks in advance.

Erik Kalkoken
  • 30,467
  • 8
  • 79
  • 114
  • 1
    If Lex's Slack channel is set up correctly, then it should provide the correct challenge response. From the documentation you mention, try re-doing Step 4 and make sure you use the exact (check for spaces, if you copy paste) `Client Id`, `Client secret`, and `Verification Token` from Slack, mentioned at the end of Step 3. – Jay A. Little Sep 23 '18 at 06:17

2 Answers2

0

I encountered this this morning and I thought I'd add my own experience. Slack appears to be pushing a 'Verification Token' as a replacement for the 'Signing Key', and claims they're interchangeable but that the token is more secure. I wasn't able to get the challenge response when using the token, but it worked fine when using the key.

0

Came across the same issue. The POST request that Slack was sending my endpoint was not what my function was designed for. I followed the tutorial at https://api.slack.com/tutorials/events-api-using-aws-lambda and had to add a line:

exports.handler = (data, context, callback) => {
    data = JSON.parse(data.body); // added this line
    switch (data.type) {
        case "url_verification": verify(data, callback); break;
        case "event_callback": process(data.event, callback); break;
        default: callback(null);
    }
};