# Publishing to SNS from Action

**URL:** <https://community.auth0.com/t/publishing-to-sns-from-action/74553>\
**Category:** Get Help\
**Created:** [December 9, 2021, 9:06am UTC](https://community.auth0.com/t/publishing-to-sns-from-action/74553 "2021-12-09T09:06:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![misiakpjon](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/misiakpjon/32/33224_2.png) [@misiakpjon](https://community.auth0.com/u/misiakpjon)\
**Post date:** [December 9, 2021, 9:06am UTC](https://community.auth0.com/t/publishing-to-sns-from-action/74553/1 "2021-12-09T09:06:05Z")

</div>

Hi all,  
I want to publish to an SNS queue using a Post Registration action.

From the looks of it the built in SNS integration only works for SMS so I believe I have to build a custom post registration action.

My current action looks like this

```auto
exports.onExecutePostUserRegistration = async (event) => {
    // Load the AWS SDK for Node.js
  // Set region
  var AWS = require("aws-sdk");
  AWS.config.update({region: 'us-east-1'});
  var awsSNS = new AWS.SNS({ 
    credentials: new AWS.Credentials("ACCESS_ID", "ACCESS_SECRET") 
  });

  var params = { Message: JSON.stringify("fromAUth0"), TopicArn: "MY_TOPIC_ARN"};
  awsSNS.publish(params);

}

```

When I run this (with my key/secret/arn filled in) I get a 200 response, but I don’t see any results from my lambda (which is subscribed to my SNS) or evidence it was called. Am I missing a step? Is there some easier way to do this?

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [December 16, 2021, 10:25pm UTC](https://community.auth0.com/t/publishing-to-sns-from-action/74553/4 "2021-12-16T22:25:11Z")

</div>

Hi @misiakpjon

Welcome to the Auth0 Community!

What exactly are you seeing in the response?

It looks like the example AWS docs has this set up with a promise.

---

<div class="post-metadata">

**Author:** ![misiakpjon](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/misiakpjon/32/33224_2.png) [@misiakpjon](https://community.auth0.com/u/misiakpjon)\
**Post date:** [December 24, 2021, 8:16pm UTC](https://community.auth0.com/t/publishing-to-sns-from-action/74553/5 "2021-12-24T20:16:15Z")

</div>

I was not able to get any of the SNS examples working, so I decided to use an API Gateway-\>Lambda instead of SNS-\>Lambda and was able to get that working very easily.

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [January 4, 2022, 8:01pm UTC](https://community.auth0.com/t/publishing-to-sns-from-action/74553/6 "2022-01-04T20:01:24Z")

</div>

Glad you were able to get that working. Thanks for the update!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [January 19, 2022, 8:02pm UTC](https://community.auth0.com/t/publishing-to-sns-from-action/74553/7 "2022-01-19T20:02:01Z")

</div>

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.
