> **Experimental**
>
> `@aws-cdk/aws-iot-actions-alpha` is an [**experimental**](/stability) (alpha) package: its API may change in any release, without a major version bump.
# SnsTopicActionProps

Configuration options for the SNS topic action.

Extends: SnsTopicActionProps
Extends: CommonActionProps
Used as props by: SnsTopicAction

- Stability: [Experimental](/cdk/api/stability.html)
- Source: [`lib/sns-topic-action.ts`](https://github.com/aws/aws-cdk/blob/v2.274.0-alpha.0/packages/@aws-cdk/aws-iot-actions-alpha/lib/sns-topic-action.ts#L25)

## Example

```ts
import * as sns from 'aws-cdk-lib/aws-sns';

const topic = new sns.Topic(this, 'MyTopic');

const topicRule = new iot.TopicRule(this, 'TopicRule', {
  sql: iot.IotSql.fromStringAsVer20160323(
    "SELECT topic(2) as device_id, year, month, day FROM 'device/+/data'",
  ),
  actions: [
    new actions.SnsTopicAction(topic, {
      messageFormat: actions.SnsActionMessageFormat.JSON, // optional property, default is SnsActionMessageFormat.RAW
    }),
  ],
});
```

## Properties

- `messageFormat`: [SnsActionMessageFormat](/cdk/api/v2/docs/@aws-cdk_aws-iot-actions-alpha.SnsActionMessageFormat.html) = SnsActionMessageFormat.RAW — The message format of the message to publish.

  SNS uses this setting to determine if the payload should be parsed and relevant platform-specific bits of the payload should be extracted.

- `role`: [IRole](/cdk/api/v2/docs/aws-cdk-lib.aws_iam.IRole.html) = a new role will be created — The IAM role that allows access to AWS service.
