This article is a Private article. Only a writer and users who know the URL can access it.
Please change open range to public in publish setting if you want to share this article with other users.

Amazon SESをStep Functionsから利用する

Posted at

ワークショップのおまけ資料です。
本編ではSNSを利用してメールを送信しましたが、この資料を参考にして、SESからメールを送ることも可能です。

スクショとJSONだけメモ的に入れていますが、文章を書く時間がありませんでした・・・
スクショを見ながら、なんとなくやってみてください。

Setup

スクリーンショット 2024-07-25 16.45.15.png
スクリーンショット 2024-07-25 16.45.33.png

スクリーンショット 2024-07-26 14.10.02.png
スクリーンショット 2024-07-26 14.10.10.png
スクリーンショット 2024-07-26 14.10.37.png
スクリーンショット 2024-07-26 14.10.58.png
スクリーンショット 2024-07-26 14.11.20.png
スクリーンショット 2024-07-26 14.11.39.png
スクリーンショット 2024-07-26 14.11.53.png
スクリーンショット 2024-07-26 14.13.30.png
スクリーンショット 2024-07-26 14.13.40.png
スクリーンショット 2024-07-26 14.14.25.png
スクリーンショット 2024-07-26 14.14.44.png
スクリーンショット 2024-07-26 14.15.06.png

Send email from step functions

スクリーンショット 2024-07-26 14.16.02.png
スクリーンショット 2024-07-26 14.16.17.png

{
                    "FromEmailAddress": "your_verified_email@example.com",
                    "Destination": {
                        "ToAddresses": [
                            "recipient@example.com"
                        ]
                    },
                    "Content": {
                        "Simple": {
                            "Subject": {
                                "Data": "Test Email from Step Functions",
                                "Charset": "UTF-8"
                            },
                            "Body": {
                                "Text": {
                                    "Data": "This is a test email sent from an AWS Step Function.",
                                    "Charset": "UTF-8"
                                }
                            }
                        }
                    }
                }

送信先のメールアドレスを、StripeのCheckout / Payment Linksで入力されたメールアドレスにする場合。

{
  "FromEmailAddress": "your_verified_email@example.com",
  "Destination": {
    "ToAddresses.$": "States.Array($.detail.data.object.customer_details.email)"
  },
  "Content": {
    "Simple": {
      "Subject": {
        "Data": "Test Email from Step Functions",
        "Charset": "UTF-8"
      },
      "Body": {
        "Text": {
          "Data": "This is a test email sent from an AWS Step Function.",
          "Charset": "UTF-8"
        }
      }
    }
  }
}
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up