Skip to content

Instantly share code, notes, and snippets.

@track3jyo-hama
Created December 26, 2022 07:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save track3jyo-hama/9e848e2eb583bc8a1fc6c9604cc6a2b7 to your computer and use it in GitHub Desktop.
Save track3jyo-hama/9e848e2eb583bc8a1fc6c9604cc6a2b7 to your computer and use it in GitHub Desktop.
{
"Comment": "A description of my state machine",
"StartAt": "Map",
"States": {
"Map": {
"Type": "Map",
"ItemProcessor": {
"ProcessorConfig": {
"Mode": "INLINE"
},
"StartAt": "Base64デコード& String to Json",
"States": {
"Base64デコード& String to Json": {
"Type": "Pass",
"Next": "ツイートの感情分析",
"Parameters": {
"data.$": "States.StringToJson(States.Base64Decode($.data))"
}
},
"ツイートの感情分析": {
"Type": "Task",
"Parameters": {
"LanguageCode": "ja",
"Text.$": "$.data.body"
},
"Resource": "arn:aws:states:::aws-sdk:comprehend:detectSentiment",
"ResultSelector": {
"Sentiment.$": "$.Sentiment"
},
"ResultPath": "$.TaskResult",
"Comment": "感情分析",
"Next": "ネガティヴツイートの分岐"
},
"ネガティヴツイートの分岐": {
"Type": "Choice",
"Choices": [
{
"Variable": "$.TaskResult.Sentiment",
"StringEquals": "NEGATIVE",
"Next": "でもそこが好き...♡"
}
],
"Default": "そのままツイートしちゃえ!"
},
"でもそこが好き...♡": {
"Type": "Pass",
"End": true,
"Parameters": {
"name.$": "$.data.name",
"twitter_id.$": "$.data.twitter_id",
"created_at.$": "$.data.created_at",
"body.$": "States.Format('{} \n でもそこが好き...♡!', $.data.body)"
}
},
"そのままツイートしちゃえ!": {
"Type": "Pass",
"End": true,
"Parameters": {
"name.$": "$.data.name",
"twitter_id.$": "$.data.twitter_id",
"created_at.$": "$.data.created_at",
"body.$": "$.data.body"
}
}
}
},
"End": true,
"MaxConcurrency": 5
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment