Search code examples
amazon-web-servicesslackamazon-ses

How to confirm a slack subscription to an aws SNS topic?


I have a lambda function that notifies an SNS topic.
It currently sends an email each time I invoke the function so the lambda, the SNS piece and the email subscription are all working ok.

Now I want a Slack Integration.

I've created a channel called aws_int but I can't get it to receive the notification.

I am stuck on the need to 'verify the subscription'. I don't see how I would do this in the https connection to slack.

I don't understand how to do it manually using the console in aws because all the documentation keeps referring to using the 'Subscription Confirmation URL'

I can't find what that is.

enter image description here

enter image description here

but I cannot find what that is.

I found a post talking about the JSON being invalid: Confirming AWS SNS Topic Subscription for Slack Webhook but I don't understand how I would use that, maybe I could use Postman but I am not sure exactly how to format that POST.

So how can I integrate Slack and aws for an SNS topic, specifically how can I do the confirmation (which is required in order to activate it). This has to be a common need!

If I use the hook URL I get

enter image description here

Everything I am trying is just stacking up more Pending Confirmations, which btw I cannot delete...

enter image description here

Here's my postman attempt...

enter image description here


Solution

  • It doesn't look like there is a way to confirm an SNS subscription to a Slack endpoint (email, webhook, whatever). If you want to use SNS as a decoupling layer, you'll need to add a lambda into the system, which can handle the confirmation process.

    Lambda -> webhook -> SNS -> Lambda -> webhook -> Slack

    Confirming AWS SNS Topic Subscription for Slack Webhook has some more information about this.