Skip to main content

AWS SNS ExecModule

Overview

AwsSnsModule connects ValkyrAI workflows to Amazon Simple Notification Service through the bundled AWS SDK v2 client. It covers n8n's core create-topic, delete-topic, and publish actions while adding topic and subscription discovery, guarded subscription changes, fixed region routing, verified IntegrationAccount credentials, bounded output, and annotation-backed Workflow Studio discovery.

The connector implements eight operations:

  • topic discovery: list_topics, get_topic_attributes
  • topic lifecycle: create_topic, delete_topic
  • notification delivery: publish
  • subscription lifecycle: list_subscriptions_by_topic, subscribe, unsubscribe

Direct SMS, email, mobile-platform endpoints, insecure HTTP subscriptions, topic policy mutation, delivery-policy mutation, confirmation-token handling, tagging, and batch publish are intentionally outside this first governed surface.

Usage

  1. Create a dedicated AWS IAM principal scoped to the exact SNS topics and actions the workflow needs.
  2. Store its access key ID and secret access key in an AWS IntegrationAccount, verify the account, and keep it in READY status.
  3. Add AwsSnsModule to a workflow and bind the account through ExecModuleConfig.authConfig.integrationAccount.
  4. Set operation, region, and the operation-specific topic, message, endpoint, pagination, or confirmation fields.
  5. Preserve topic ARNs, subscription ARNs, message IDs, and AWS request IDs. Reconcile provider state before replaying an ambiguous write.

Never place AWS credentials in mapped input, message attributes, logs, or examples. Credential-like input fields are rejected before provider access.

Inputs

NameTypeRequired forDefaultConstraints
operationstringEvery executionNoneOne of the eight documented operations.
regionstringEvery executionNoneAWS region syntax such as us-west-2; custom endpoints are not accepted.
topicArnstringTopic-specific operationsNoneExact SNS topic ARN in the configured partition, region, and 12-digit account.
topicNamestringcreate_topicNone1-256 letters, numbers, hyphens, or underscores; FIFO creation appends .fifo when needed.
displayNamestringOptional create_topicNoneAt most 100 characters, with no control characters.
fifoTopicbooleanOptional create_topicfalseMust be true for a .fifo topic.
contentBasedDeduplicationbooleanOptional FIFO createfalseRequires fifoTopic=true.
messagestringpublishNoneNon-empty UTF-8 content within the 256 KiB aggregate SNS envelope.
subjectstringOptional publishNoneAt most 100 characters, with no control characters.
messageAttributesobjectOptional publish{}At most ten non-empty String attributes; AWS/Amazon reserved prefixes and invalid periods are rejected.
messageGroupIdstringFIFO publishNoneRequired for FIFO topics; at most 128 bytes. Optional for standard topics.
messageDeduplicationIdstringOptional FIFO publishNoneFIFO only; at most 128 bytes.
protocolstringsubscribeNoneOne of https, sqs, or lambda; insecure HTTP, email, SMS, and mobile endpoints are not exposed.
endpointstringsubscribeNoneAbsolute HTTPS URL without embedded credentials/fragments, or a region-matched SQS/Lambda ARN.
subscriptionArnstringunsubscribeNoneConfirmed SNS subscription ARN in the configured region.
nextTokenstringOptional list resumeNoneOpaque AWS continuation, at most 4,096 characters.
limitintegerList operations1001-10,000 results.
returnAllbooleanList operationsfalseFollow provider pages until exhaustion or limit.
confirmSubscribebooleansubscribefalseMust be explicitly true before AWS creates a subscription.
confirmDeletebooleandelete_topic, unsubscribefalseMust be explicitly true before either destructive operation.

Outputs

Every execution returns stable status, operation, and attempts fields.

NameTypeWhen presentDescription
statusstringAlwayssuccess or error.
operationstringAlwaysNormalized operation.
attemptsintegerAlwaysProvider calls, including discovery retries and pages.
dataobjectAttribute or mutation successTopic attributes/ARN, publish receipt, subscription receipt, or deletion receipt.
itemsarrayList successBounded topic or subscription records.
countintegerList successNumber of returned items.
hasMorebooleanList successWhether another provider page exists.
nextTokenstringAnother page existsOpaque continuation for a later execution.
requestIdstringAWS supplies oneBounded provider reference for reconciliation and support.
errorobjectFailureSafe {code, message, httpStatus?, retryable} details.

Subscription items contain bounded subscriptionArn, owner, protocol, endpoint, and topicArn fields. Treat endpoint values and notification bodies as confidential workflow data.

IntegrationAccount Requirements

Bind one AWS IntegrationAccount through the normalized ExecModule authentication relationship:

FieldRequirement
ProviderAmazon Web Services / SNS
statusMust be READY.
verifiedMust be true.
apiKey SecureFieldAWS access key ID.
password SecureFieldAWS secret access key.

Grant only the actions used by the workflow:

  • sns:ListTopics for list_topics
  • sns:GetTopicAttributes for get_topic_attributes
  • sns:CreateTopic for create_topic
  • sns:DeleteTopic for confirmed delete_topic
  • sns:Publish for publish
  • sns:ListSubscriptionsByTopic for subscription discovery
  • sns:Subscribe for confirmed subscribe
  • sns:Unsubscribe for confirmed unsubscribe

Restrict resource-scoped actions to the exact topic ARNs. The current connector supports a long-lived access-key pair. Temporary session credentials, role assumption, cross-account role chaining, VPC/custom endpoints, and caller-supplied credentials are deferred.

Configuration

The awsAccount relationship is the only credential configuration. Operation, region, topic, message, endpoint, pagination, and confirmation controls belong in module parameters or mapped input; read retries use the normalized retry policy.

{
"version": "1.0.0",
"authConfig": {
"authStrategy": 1,
"integrationAccount": "integration-account:aws-sns-production"
},
"retryPolicy": {
"maxAttempts": 3
},
"payloadConfig": {
"parameters": "{\"operation\":\"publish\",\"region\":\"us-west-2\",\"topicArn\":\"arn:aws:sns:us-west-2:123456789012:agent-events\"}"
}
}

The relationship value is illustrative. Persisted workflows bind the generated IntegrationAccount relationship, never plaintext credentials.

Operations

OperationProvider behaviorSide effect and retry behavior
list_topicsLists region topics with opaque token pagination.Read-only; transient failures retry within the configured bound.
get_topic_attributesReads the attributes of one exact topic.Read-only; transient failures retry.
create_topicCreates or resolves a named standard/FIFO topic with bounded attributes.External write; exactly one provider attempt. AWS treats the same name and attributes idempotently but rejects mismatches.
delete_topicDeletes one exact topic.Destructive; requires confirmDelete=true; exactly one provider attempt.
publishPublishes one bounded message and String attributes to a topic.External fan-out; exactly one provider attempt.
list_subscriptions_by_topicLists up to 100 subscriptions per AWS page.Read-only; transient failures retry.
subscribeCreates an HTTPS, SQS, or Lambda subscription and asks AWS to return its ARN.External write; requires confirmSubscribe=true; exactly one provider attempt. HTTPS endpoints still complete AWS confirmation.
unsubscribeRemoves a confirmed subscription ARN.Destructive; requires confirmDelete=true; exactly one provider attempt.

Errors and Failure Modes

CodeTypical causeRetryableResolution
VALIDATION_ERRORMissing or invalid region, ARN, topic, message, endpoint, bound, FIFO option, or confirmation.NoCorrect the named input; no provider request was sent.
UNSUPPORTED_OPERATIONUnknown operation.NoSelect a documented operation.
INTEGRATION_ACCOUNT_ERRORAccount missing, unverified, not READY, or missing key material.NoRepair and bind the AWS account.
AWS_SNS_HTTP_400Invalid ARN, message envelope, endpoint, or FIFO option.No automatic write retryInspect the current topic/subscription state before replay.
AWS_SNS_HTTP_403IAM denies the action or an account quota is reached.Provider-dependentGrant only the required action or resolve the quoted AWS limit.
AWS_SNS_HTTP_404Topic or subscription is absent or invisible.NoVerify partition, region, account, and exact ARN.
AWS_SNS_HTTP_429 / 503Transient provider pressure.Yes for discovery onlyDiscovery can retry; reconcile mutations before replay.
NETWORK_ERRORDNS, TLS, timeout, or connectivity failure.Yes for discovery onlyTreat publish and lifecycle outcomes as ambiguous.
EXECUTION_ERRORUnexpected bounded runtime failure.No automatic replayPreserve ARNs, message identifiers, and request IDs for reconciliation.

Provider exception text is not copied into output, preventing credential echoes and unbounded error payloads.

Example

Publish a correlated agent event:

{
"operation": "publish",
"region": "us-west-2",
"topicArn": "arn:aws:sns:us-west-2:123456789012:agent-events",
"subject": "Workflow event",
"message": "{\"jobId\":\"job-123\",\"action\":\"enrich_customer\"}",
"messageAttributes": {
"correlationId": "workflow-2026-09-04-job-123",
"tenant": "acme"
}
}

Expected result shape:

{
"status": "success",
"operation": "publish",
"attempts": 1,
"requestId": "aws-request-reference",
"data": {
"messageId": "provider-message-id"
}
}

Notes

  • Pagination: list_topics and list_subscriptions_by_topic preserve AWS tokens as opaque values. returnAll=true follows only the configured region and stops at limit or 10,000 results. AWS returns at most 100 subscriptions per page.
  • Rate limits: HTTP 408, 429, 500, 502, 503, and 504 plus network failures can retry only for list/get operations, bounded by RetryPolicy.maxAttempts from 1 through 5. AWS SDK retries are disabled so module accounting and single-attempt writes remain deterministic.
  • API limits: message content plus attribute names/types/values is bounded at 262,144 bytes. Subject and display name are bounded at 100 characters. Topic, endpoint, ARN, token, and result counts are also bounded before use.
  • Idempotency: create_topic is provider-idempotent only when the existing topic has identical attributes. Standard topic publish has no provider idempotency key. FIFO publish supports a five-minute deduplication window through messageDeduplicationId or content-based deduplication; callers must still reconcile ambiguous responses.
  • Destructive behavior: delete_topic removes the topic and its subscriptions; unsubscribe removes delivery to one endpoint. Both require confirmDelete=true and are attempted once.
  • Subscription safety: only HTTPS, region-matched SQS, and region-matched Lambda endpoints are allowed. HTTPS subscriptions can remain pending until the endpoint confirms AWS's request; the module does not consume confirmation tokens.
  • Delivery semantics: a returned message ID means SNS accepted the message, not that every endpoint delivered it. Subscriber retry, dead-letter, ordering, filtering, and delivery policies remain provider-managed.
  • Data handling: messages, attributes, subjects, and subscription endpoints are confidential. The module never logs request or response bodies.
  • Provider verification boundary: deterministic tests cover validation, fixed routing, account isolation, request mapping, pagination, retry boundaries, normalization, redaction, registration, FIFO rules, and confirmation guards. Live AWS behavior remains unverified until an authorized SNS credential and reviewed topic are supplied.
  • Functional reference: n8n's AWS SNS integration exposes create topic, delete topic, and publish. ValkyrAI adds topic attributes, subscription discovery and lifecycle, strict ARN/endpoint validation, verified IntegrationAccount enforcement, bounded output, explicit confirmations, and conservative single-attempt semantics.
  • Runtime boundary: merged source and published documentation do not update the deployed Workflow Studio catalog until a ValkyrAI backend release exposes AwsSnsModule through /v1/modules/metadata.