Publish Message
In this article
Overview
You can use this Snap to send a message to an Amazon SNS topic. The message can be a text message (SMS message) directly to a phone number, or a message to a mobile platform endpoint (when you specify the TargetArn ). If you send a message to a topic, Amazon SNS delivers the message to each endpoint that is subscribed to the topic.
When you use this Snap to publish a message, that message can be consumed through various means, including subscription through the SQS Consumer Snap, email, or HTTP endpoint. If the message is under 256 KB, you can view it directly in the output preview. However, if it exceeds 256KB, the message's content does not display. Instead, a reference to the message is provided, typically in the form of an array of JSON object ontaining an S3 Key and S3 Bucket Name. To read the message, use the S3 File Reader, Email Reader, or S3 Download or S3 Select Snaps downstream of the Publish Message Snap. Refer to the following examples:
Prerequisites
Valid AWS Account and SNS access.
Authentication such as IAM Role access, Access key, and Security Access key.
Create Topic and Subscribe Topic to an endpoint (SQS/Email/Email-JSON etc) before performing the Publish Message action.
Set Attribute Name in Set Subscription Attribute to
FilterPolicy
if you want to select Number, String, or String Array data types under Message attributes in Publish Message Snap.
Support for Ultra Pipelines
Works in Ultra Pipelines.
Limitations
The SnapLogic user interface (UI) has a maximum limit of 200 MB on the size of messages you can copy in the Message field of the Publish Message Snap. If the message size exceeds this limit, the Snap fails and displays an error message stating that the: 'update' command document is too large
Work-around: To publish messages greater than 200 MB, you can use upstream Snaps and input the message into the Publish Message Snap.
Â
Known Issues
The Snap’s performance might decrease if you do not provide a value in the Region field. As a workaround, provide a value in the Region field for optimal performance of the Snap.
Snap Views
Input/Output | Type of View | Number of Views | Examples of Upstream and Downstream Snaps | Description |
---|---|---|---|---|
Input | Document |
| Mapper | Region, ARN of the topic and the text message that you want to publish. |
Output | Document |
| Copy | Published message |
Error | Error handling is to have a generic way to handle errors without losing data or failing the Snap execution. You can handle the errors that might arise while running the Pipeline by choosing one of the options from the When errors occur section under the Views tab. The options available are:
See Error View in Pipeline in examples to understand the Snap error view settings and error output. For more information on the error view and handling error output in a Pipeline, see Error handling in Pipelines. |
Snap Settings
Asterisk (*): Indicates a mandatory field.
Suggestion icon (): Indicates a list that is dynamically populated based on the configuration.
Expression icon (): Indicates whether the value is an expression (if enabled) or a static value (if disabled). Learn more about Using Expressions in SnapLogic.
Add icon (): Indicates that you can add fields in the field set.
Remove icon (): Indicates that you can remove fields from the field set.
Field Name | Field Type | Field Dependency | Description | |
---|---|---|---|---|
Label*  Default Value: N/A | String | N/A | Specify the name for the Snap. You can modify this to be more specific, especially if you have more than one of the same Snap in your Pipeline.  | |
Region  Default Value: None | String/Expression | N/A | Specify the AWS region where the application is implemented. If the region field is not present, then the region will be evaluated in the following sequence:
 | |
Topic Arn* Â Default Value: N/A | String/Expression | N/A | Specify the Amazon Resource Name (ARN) of the topic. If you enable expression for Topic Arn, then Message group ID and Deduplicate ID fields are populated. | |
Subject  Default Value: N/A | String/Expression | N/A | Specify the subject line to be included while delivering in the messages. | |
Message Structure Default Value: TEXT | Dropdown list | If the property is set to JSON, then the Customised Messages field set and Message property is enabled. You can send messages to various protocols using the fieldset. | Select one of the following options to provide the structure or type of the message that you want to publish. Available options are:
| |
Message  Default Value: N/A | String/Expression | N/A | Specify the message you want to publish. | |
Customized Messages | Appears when you select JSON in the Message Structure field. You can add any number of messages by clicking the icon on the field set. | |||
Protocol  Default Value: N/A | String/Expression | N/A | Specify the internet protocol to connect to Amazon server. Alternatively click the Suggestion icon to fetch a list of attribute names associated with the entity type. Available options are:
| |
Message  Default Value: N/A | String/Expression | N/A | Specify the message you want to publish. | |
Message group ID  Default value: N/A | String/Expression | Displayed when you enable expression for Topic Arn. | Specify a tag that indicates which message group this message belongs to. The field is used and required by FIFO queue. Messages in the same message group are delivered in the order that they are published. For more information refer to FIFO Queue Recommendations - Message Group Id.  | |
Deduplicate ID  Default value: N/A | String/Expression | Displayed when you enable expression for Topic Arn. | Specify the token used for de-duplication of sent messages in FIFO queue. This ID is optional if you enabled the Content-based message deduplication setting for the topic. For more information refer to FIFO Queue Recommendations - Deduplicate Id. | |
Message attributes
| Specify the table of the message attributes. Message attributes are structured metadata for the message to help the consumer identify how to deal with the message without having to read the message body. Each message can have up to 10 attributes. The value type is string. | |||
Attribute Name  Default value: N/A | String/Expression | N/A | Specify the name for the message attribute. By default this field is expression enabled. | |
Data type  Default value: Number | String/Expression/Dropdown list | N/A | Specify the datatype of the message attribute. Available options are:
| |
Attribute Value  Default value: N/A | String/Expression | N/A | Specify the value for the message attribute. By default this field is expression enabled. | |
Snap Execution  Default Value: Execute only | Dropdown list | N/A | Select one of the three modes in which the Snap executes. Available options are:
|
Troubleshooting
Error | Reason | Resolution |
---|---|---|
Missing Topic ARN. | Â A topic ARN value is not provided. | Specify the topic ARN and retry. |
No default entry in JSON message body | The Message field is empty while Message Attribute is set to JSON. | Enter the message in the Message field. |
An error occurred when publishing a message to the specific topic in the Amazon SNS. | Failed to store the message content in an S3 object. | Check the input data, formats and retry. |
Examples
Publishing Messages Larger than 256 KB
Publish Messages to the Amazon SQS Endpoint
This example pipeline demonstrates how you can read a message after it is published by the Publish Message Snap.
The above pipeline performs the following steps:
Read the file from the S3 Bucket.
Extract the content of the message.
Publish the message.
Read the message.
Â
Prerequisites:
A valid S3 account.
Step 1: Configure the S3 File Reader Snap to read the file from the S3 bucket. On validation, this Snap displays the binary output in the preview.
 |
Step 2: Configure the Binary to Document Snap to convert the file content that is in binary format to document format.
Step 3: Configure the Mapper Snap to extract only the content of the message.
Step 4: Configure the Publish Message Snap to publish the message to the ARN topic in the SQS endpoint. On validation, the Snap displays the output with the details of the message payload.
Step 5: Configure the SQS Consumer Snap to consume the message. On validation, the Snap displays the reference of the payload (message payload contains the name of the S3 Bucket Name and S3 Key details). The Secret key allows you to open the message.
 |  |
Step 6: Configure the File Writer Snap to write the message in the SnapLogic database.
Step 7: Configure the File Reader Snap to read the message.
Publish Messages to an Email Endpoint
This example pipeline demonstrates how you can read a message after it is sent to the email endpoint.
Prerequisites:
A valid S3 account.
Step 1: Configure the Publish Message Snap to send a message (to the email endpoint) greater than 256 KB. On validation, the Snap displays the output with the message payload details.
Step 2: Configure the Mapper Snap to extract the content of the message.
Step 3: Configure the Email Reader Snap to read the message. On validation, the Snap sends an email with the message payload details (S3 Bucket name and Secret key).
 |   |
Step 4: Configure the Filter Snap to filter the messages above 256 KB from the email endpoint.
Step 5: Configure the Mapper Snap with the S3 Bucket name and Secret key to enable the download of the message.
Step 6: Configure the S3 Download Snap with the S3 Bucket name to download the message. On validation, the output preview shows the location of the downloaded message and the message details.
 |  |
Publishing Messages Lesser than 256 KB
This example pipeline demonstrates how you can publish a message lesser than 256 KB to an Email endpoint.
Publish Message to Email Endpoint
Step 1: Configure the Publish Message Snap to send a message (to the email endpoint). On validation, the Snap displays the output with the message payload details.
 |
Step 2: Configure the Email Reader Snap to read the message. On validation, the Snap sends a message to a specified email address.
   |
Step 3: Configure the Filter Snap with the filter expression as follows to filter messages less than 256 KB:
Filter expression: $subject.contains("Subject_SNS_Publish_Text_message_to_IdenticalPayload_allDeliveryProtocols_6d") && $textBody.contains("arn:aws:sns:us-west-2:740934760981:SNS_427_SNPQA_Create_Topic_PublishMessage_Scenario_6d2")
Step 4: Configure the Head Snap to send the input documents to the output view relative to the start of the input stream.
Step 5: Configure the Mapper Snap to extract the content of the message. On validation, the Snap displays the message content in the output preview.
 |
Downloads
Snap Pack History
Related Content
Have feedback? Email documentation@snaplogic.com | Ask a question in the SnapLogic Community
© 2017-2024 SnapLogic, Inc.