{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "kms:Encrypt" ], "Resource": "*" } ] }
リージョン: アジアパシフィック(東京)
エイリアス:lambdaSlackTest
$ aws configure AWS Access Key ID [None]: xxxxxxxxxx AWS Secret Access Key [None]: xxxxxxxxxx Default region name [None]: ap-northeast-1 Default output format [None]: json
$ aws kms encrypt --key-id alias/lambdaSlackTest --plaintext "<token name>" { "KeyId": "arn:aws:kms:ap-northeast-1:xxxxxxxxxxxx:key/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "CiphertextBlob": "<encrypted token>" }
Name: Slack-echo-command-python
Runtime: Python 2.7
Role: lambda-slack-integration-test ※新規作成
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "kms:Decrypt" ], "Resource": [ "arn:aws:kms:ap-northeast-1:xxxxxxxxxxxx:key/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" ] } ] }
ポリシー名:putlogs
ポリシー:
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "logs:CreateLogGroup", "logs:CreateLogStream", "logs:PutLogEvents" ], "Resource": "arn:aws:logs:*:*:*" } ] }
{ "body": "token=<token name>&team_id=T0001&team_domain=example&channel_id=C2147483705&channel_name=test&user_id=U2147483697&user_name=Steve&command=/weather&text=94070&response_url=https://hooks.slack.com/commands/1234/5678" }
"Steve invoked /weather in test with the following text: 94070"
API endpoint type: API Gateway
API name: LambdaPythonSlackintegrationTest
Resource name: /Slack-echo-command-python
Method: POST
Deployment stage: prod
Security: Open
Content-Type: application/x-www-form-urlencoded
Template: { "body": $input.json("$") }
https://xxxxxxxxxx.execute-api.ap-northeast-1.amazonaws.com/prod/Slack-echo-command-python
/sayhello test
"<user> invoked /sayhello in directmessage with the following text: test"