{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":21321,"path":"integrate-applications/integration-hub/notification-sns.md","title":"Receive events at your ServiceNow instance from Amazon SNS","bundle":null,"doc_type":null,"release":"australia","body":"\n# Receive events at your ServiceNow instance from Amazon SNS\n\nReceive events \\(Notification, Subscription Confirmation, and Unsubscribe Confirmation\\) from Amazon SNS at your ServiceNow instance.\n\n## Before you begin\n\n-   Request an Integration Hub subscription\n-   Activate the Amazon SNS spoke\n-   Role required: admin\n\n## About this task\n\nYou can receive events at your ServiceNow instance from Amazon SNS even without setting up the Amazon SNS spoke. To set up the Amazon SNS spoke and use the spoke actions, see [Set up the Amazon SNS spoke](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/integrate-applications/integration-hub/setup-amazon-sns.md).\n\n## Create secret for the Amazon SNS spoke\n\nCreate a client secret to authorize requests from Amazon SNS.\n\n### Before you begin\n\nRole required: admin.\n\n### Procedure\n\n1.  Navigate to **All** &gt; **System Definition** &gt; **Scripts - Background**.\n\n2.  Enter this command in the **Run script \\(JavaScript executed on server\\)** text field:\n\n    `gs.info(GlideSecureRandomUtil.getSecureRandomString(32));`\n\n3.  Click **Run Script**.\n\n4.  Copy and record the generated value for later use.\n\n    \\[Omitted image \"auth-token.png\"\\] Alt text: Client Secret or Authorization Key\n\n\n## Create a record in AWS Configurations\n\nCreate a record in AWS Configurations to authorise requests from Amazon SNS spoke.\n\n### Before you begin\n\nRole required: admin.\n\n### Procedure\n\n1.  Navigate to **All** &gt; **AWS Configuration** &gt; **All Configurations**.\n\n2.  Click **New**.\n\n3.  On the form, fill in the fields.\n\n<table id=\"table_gky_zp1_qkb\"><thead><tr><th>\n\nField\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nProperty Value\n\n</td><td>\n\nInternal name of the Amazon SNS Subscription subflow. For example, `amazon_sns_subscription`.**Note:** The Amazon SNS Subscription subflow is a sample subflow. You must create a copy of this subflow and use it to customize event management as per your requirement. In this case, specify the internal name of the customized subflow.\n\n</td></tr><tr><td>\n\nProperty Name\n\n</td><td>\n\nName to identify the record.\n\n</td></tr><tr><td>\n\nClient Secret\n\n</td><td>\n\nClient Secret generated by the script. For information about generating Client Secret see, [Create secret for the Amazon SNS spoke](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/integrate-applications/integration-hub/notification-sns.md).\n\n</td></tr></tbody>\n</table>4.  Right-click the form header and click **Save**.\n\n5.  Right-click the form header and click **Copy sys\\_id**. Record this value for later use.\n\n\n## Record the Base API path of the Amazon SNS spoke\n\nRecord the Base API path of the Amazon SNS spoke to authorise requests from Amazon SNS.\n\n### Before you begin\n\nRole required: admin.\n\n### Procedure\n\n1.  Navigate to **All** &gt; **System Web Services** &gt; **Scripted Web Services** &gt; **Scripted REST APIs**.\n\n2.  Open the record for **Amazon SNS**.\n\n3.  Copy and record the value of **Base API path** for later use.\n\n\n## Create topic\n\nUse the Create Topic spoke action to create a topic in Amazon SNS for your ServiceNow instance.\n\n### Before you begin\n\nRole required: admin.\n\n### Procedure\n\n1.  In Workflow Studio, create a flow and include the Create Topic spoke action.\n\n    For information about creating flows in Workflow Studio, see [Building flows](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/build-workflows/flows.md).\n\n2.  Customize flow to provide these values as inputs to the Create Topic spoke action:\n\n    |Field|Description|\n    |-----|-----------|\n    |Region|AWS geographic area where the infrastructure is housed.|\n    |Topic Name|Name to identify the topic.|\n\n3.  Test the flow and check the **Executions** tab to ensure that flow is executed as expected.\n\n\n## Create subscription\n\nUse the Create Subscription spoke action to create subscription in Amazon SNS for your ServiceNow instance.\n\n### Before you begin\n\nRole required: admin.\n\n### Procedure\n\n1.  In Workflow Studio, create a flow and include the Create Subscription spoke action.\n\n    For information about creating flows in Workflow Studio, see [Building flows](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/build-workflows/flows.md).\n\n2.  Customize flow to provide these values as inputs to the Create Subscription spoke action:\n\n<table id=\"table_l1z_jsc_qkb\"><thead><tr><th>\n\nField\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nRegion\n\n</td><td>\n\nAWS geographic area where the infrastructure is housed.\n\n</td></tr><tr><td>\n\nTopic ARN\n\n</td><td>\n\nARN to uniquely identify the required topic. Subscriptions are created for this topic.\n\n</td></tr><tr><td>\n\nProtocol\n\n</td><td>\n\n**HTTPS**\n\n</td></tr><tr><td>\n\nEndpoint\n\n</td><td>\n\nEndpoint URL in this format: `https://<servicenow-instance>.service-now.com/<base-api-path>/<aws-configuration-sys_id>/<client-secret>`.**Note:** For information about obtaining the required values, see [Record the Base API path of the Amazon SNS spoke](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/integrate-applications/integration-hub/notification-sns.md), [Create a record in AWS Configurations](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/integrate-applications/integration-hub/notification-sns.md), and [Create secret for the Amazon SNS spoke](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/integrate-applications/integration-hub/notification-sns.md).\n\n</td></tr></tbody>\n</table>3.  Test the flow.\n\n    The flow internally triggers the default Amazon SNS Subscription subflow.\n\n4.  In the **Executions** tab, open the record associated with the subflow execution.\n\n    **Note:** Ensure that you check the execution details of the default Amazon SNS Subscription subflow, not the flow you had created.\n\n5.  In the Execution Details page, click **RUNTIME VALUE**.\n\n6.  Copy and record the value of Token for later use.\n\n    This confirmation token is needed to [Confirm subscription](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/integrate-applications/integration-hub/notification-sns.md).\n\n    \\[Omitted image \"runtime-value-sns.png\"\\] Alt text: Token in Runtime value.\n\n    **Note:** Ensure that you use the confirmation token to [Confirm subscription](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/integrate-applications/integration-hub/notification-sns.md) within its validity period.\n\n\n### Result\n\nSubscription for the required topic in Amazon SNS for your ServiceNow instance is created.\n\n## Confirm subscription\n\nUse the Confirm Subscription spoke action to confirm subscription in Amazon SNS for your ServiceNow instance.\n\n### Before you begin\n\nRole required: admin.\n\n### Procedure\n\n1.  In Workflow Studio, create a copy of the default Amazon SNS Subscription subflow.\n\n    For information about using subflows in Workflow Studio, see [Building subflows](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/build-workflows/subflows.md).\n\n2.  In Workflow Studio, create a flow that includes the copy of the default subflow.\n\n    For information about creating flows in Workflow Studio, see [Building flows](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/build-workflows/flows.md).\n\n3.  Customize the subflow to include the Confirm Subscription spoke action.\n\n4.  Customize subflow to provide these values as inputs to the Confirm Subscription spoke action:\n\n<table id=\"table_l1z_jsc_qkb\"><thead><tr><th>\n\nField\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nRegion\n\n</td><td>\n\nAWS geographic area where the infrastructure is housed.\n\n</td></tr><tr><td>\n\nTopic ARN\n\n</td><td>\n\nARN to uniquely identify the required topic. Subscriptions are created for this topic.\n\n</td></tr><tr><td>\n\nToken\n\n</td><td>\n\nConfirmation token generated after creating subscription. See [Create subscription](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/integrate-applications/integration-hub/notification-sns.md), for more information.**Note:** Ensure that you use the confirmation token to confirm subscription within its validity period.\n\n</td></tr></tbody>\n</table>5.  Test the flow and check the **Executions** tab to ensure that flow is executed as expected.\n\n\n### Result\n\nThe Amazon SNS subscription for your ServiceNow instance is confirmed.\n\n"}}