Light Dark

Functions

publish

fn (topic_arn: Str, message: Str, options: Map): PublishResponse | AwsError
fn (topic_arn: Str, message: Str): PublishResponse | AwsError

Publish a message to an SNS topic or directly to an endpoint.

Example

// Simple publish
result ::aws::sns::publish/publish(topic-arn, "Hello from Hot!")
result.message_id  // => "abc123-def456..."

// Publish with subject (for email subscriptions)
result ::aws::sns::publish/publish(topic-arn, "Message body", {subject: "Alert"})

publish-batch

fn (topic_arn: Str, entries: Vec): PublishBatchResponse | AwsError

Publish multiple messages to a topic in a single request (up to 10).

Each entry should have id (unique) and message (content).

Example

entries [
    {id: "msg1", message: "First message"},
    {id: "msg2", message: "Second message"},
    {id: "msg3", message: "Third message"}
]
result ::aws::sns::publish/publish-batch(topic-arn, entries)
length(result.successful)  // => 3
length(result.failed)      // => 0

publish-json

fn (topic_arn: Str, message: Map): PublishResponse | AwsError

Publish a message with protocol-specific payloads.

The message map must include a "default" key. Other keys are protocol names (email, sqs, lambda, http, https) with protocol-specific content.

Example

result ::aws::sns::publish/publish-json(topic-arn, {
    default: "Default notification",
    sqs: to-json({type: "notification", data: {order_id: "12345"}})
})
result.message_id  // => "abc123..."

publish-with-attributes

fn (topic_arn: Str, message: Str, attributes: Map): PublishResponse | AwsError

Publish a message with message attributes for subscription filtering.

Each attribute should have DataType ("String", "Number", or "Binary") and StringValue.

Example

result ::aws::sns::publish/publish-with-attributes(topic-arn, "Order placed", {
    event_type: {DataType: "String", StringValue: "order"},
    priority: {DataType: "Number", StringValue: "1"}
})
result.message_id  // => "abc123..."

send-sms

fn (phone_number: Str, message: Str, options: Map): PublishResponse | AwsError
fn (phone_number: Str, message: Str): PublishResponse | AwsError

Send an SMS message directly to a phone number (E.164 format).

Example

// Simple SMS
result ::aws::sns::publish/send-sms("+14155551234", "Your code is 123456")
result.message_id  // => "abc123..."

// SMS with options
result ::aws::sns::publish/send-sms("+14155551234", "Your code is 123456", {
    message_type: "Transactional"
})

Types

PublishBatchFailureEntry

PublishBatchFailureEntry type {
    id: Str?,
    code: Str?,
    message: Str?,
    sender_fault: Bool?
}

PublishBatchResponse

PublishBatchResponse type {
    successful: Vec,
    failed: Vec
}

PublishBatchResultEntry

PublishBatchResultEntry type {
    id: Str?,
    message_id: Str?,
    sequence_number: Str?
}

PublishResponse

PublishResponse type {
    message_id: Str?,
    sequence_number: Str?
}