30

I am integrating SNS and Slack. I have created a slack app with incoming webhook enabled. I have got the webhook URL. I created a subscription for a SNS Topic with HTTPS protocol and set the Endpoint the webhookURL. Now the subscription is PendingConfirmation. I didnot receive any confirmation message, not in the destined channel.

How do I confirm the subscription?

5 Answers 5

52

You don't need to create a lambda function or create an HTTPS subscription with Slack.

On your slack channel, add the "email integration" app. Once done, Slack will provide you an email address with slack.com domain.

Emails sent to this address will be imported into your slack channel.

Then, on SNS create an email subscription and provide the slack email above.

3
13

You can confirm the subscription WITHOUT lambda. It is easy. I found a way to integrate AWS SNS with slack WITHOUT AWS Lambda or AWS chatbot.

Follow the video which show all the step clearly. https://www.youtube.com/watch?v=CszzQcPAqNM

Steps to follow:

  • Create slack channel or use existing channel
  • Create a work flow with selecting Webhook
  • Create a variable name as SubscribeURL. The name is very important
  • Add the above variable in the message body of the workflow
  • Publish the workflow and get the url
  • Add the above Url as subscription of the SNS
  • You will see the subscription URL in the slack channel
  • Follow the URl and complete the subscription
  • Come back to the work flow and change the variable to Message
  • The publish the message in SNS. you will see the message in the slack channel.
9

The reason you're not seeing it in Slack is because the default JSON format for SNS messages doesn't conform to the format required by Slack:

You have two options for sending data to the Webhook URL above:

  • Send a JSON string as the payload parameter in a POST request
  • Send a JSON string as the body of a POST request

For a simple message, your JSON payload could contain a text property at minimum. This is the text that will be posted to the channel.

As another user suggested you can use an AWS Lambda function to facilitate this. There are free, public solutions available already, such as this one (which I did not author, and have not used...only including as a reference point).

3

You have create a lambda function that receives SNS feedback and POST it to your webhook URL.

When you create a subscription to your lambda topic you choose AWS Lambda as protocol and select the lambda that you just created.

More info about it here: https://medium.com/cohealo-engineering/how-set-up-a-slack-channel-to-be-an-aws-sns-subscriber-63b4d57ad3ea

1
3

I might be late on this topic but you can configure AWS Chatbot (slack application) to send all the notifications to your slack. More info here : https://aws.amazon.com/chatbot/

1
  • This works but Chatbot only accepts messages from specific AWS services and you cannot customize the message which is sent to slack. Sep 8, 2022 at 21:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.