入力トランスフォーマーを設定すると Chatbot のカスタム通知が通知されない事象を回避するには

入力トランスフォーマーを設定すると Chatbot のカスタム通知が通知されない事象を回避するには

Clock Icon2025.06.11

困っていた内容

Amazon Q Developer(旧 AWS Chatbot)を使ってイベントを Slack に通知する仕組みを構築中です。

EventBridge ルール -> SNS -> Chatbot -> Slack

上記最小設定で通知できることは確認しましたが、入力トランスフォーマーを設定すると通知されません。
入力トランスフォーマーによるカスタマイズはサポートされているはずですが、なぜでしょうか。

よくある質問 - AWS Chatbot | AWS

既存の EventBridge イベントを修正したりするには、イベントを Chatbot カスタム通知スキーマ形式で SNS トピックに送信します。Lambda 関数を記述するか、EventBridge InputTransformers を使用して、これらのイベントを生成することができます。

どう対応すればいいの?

入力トランスフォーマーの出力結果が、カスタム通知形式になっているか確認してください。

Custom notifications using Amazon Q Developer in chat applications - Amazon Q Developer in chat applications

Amazon Q Developer in chat channels custom notifications must use the following event format:

Chatbot のカスタム通知では、EventBridge の入力トランスフォーマーを含むカスタマイズされた通知に対応しています。
一方で、カスタム通知は指定の形式になっている必要があり、形式が異なる場合はエラーとなります。

カスタム通知のイベント構造は次の形式となり、versionsource、contentのdescriptionは必須です。

イベント構造
{
    "version": "1.0",
    "source": "custom",
    "id": String,    
    "content": {
        "textType": String, 
        "title": String,  
        "description": String, 
        "nextSteps": [ String, String, ... ], 
        "keywords": [ String, String, ... ] 
    },
    "metadata": {                     
        "threadId": String,
        "summary": String,
        "eventType": String,
        "relatedResources": [ String, String, ... ],
        "additionalContext" : {
            "customerProvidedKey1": String,
            "customerProvidedKey2": String
            ...
        },
        "enableCustomActions": true,
    }
}
最小構成
{
    "version": "1.0",
    "source": "custom",
    "content": {
        "description": ":warning: EC2 auto scaling refresh failed for ASG *OrderProcessorServiceASG*! \ncc: @SRE-Team"
    }
}

なお、Amazon Q Developerでログ出力を設定している場合、実際に送信されたイベントを確認したり、形式でエラーになっていることが確認できます。
トラブルシューティングの際はご利用ください。

https://dev.classmethod.jp/articles/tsnote-amazonq-chatbot-enable-event-log/

エラー時のログサンプル

Received event from SNS Topic: arn:aws:sns:ap-northeast-1:123456789012:hato-sns-chatbot-Slack with message body: {
    "subscribeUrl": null,
    "type": "Notification",
    "signatureVersion": "1",
    "signature": "hato-signature",
    "topicArn": "arn:aws:sns:ap-northeast-1:123456789012:hato-sns-chatbot-Slack",
    "signingCertUrl": "https://sns.ap-northeast-1.amazonaws.com/SimpleNotificationService-9c6465fa7f48f5cacd23014631ec1136.pem",
    "messageId": "3d871d6b-3c13-546b-b266-7dcd1d6e9a45",
    "message": {
        "content": {
            "description": "hato Message"
        }
    },
    "subject": null,
    "unsubscribeUrl": "https://sns.ap-northeast-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:ap-northeast-1:123456789012:hato-sns-chatbot-Slack:***REDACTED***",
    "timestamp": "2025-06-01T01:01:01.011Z",
    "token": null
}
Event received is not supported (see https://docs.aws.amazon.com/chatbot/latest/adminguide/related-services.html ): {
    "subscribeUrl": null,
    "type": "Notification",
    "signatureVersion": "1",
    "signature": "hato-signature",
    "topicArn": "arn:aws:sns:ap-northeast-1:123456789012:hato-sns-chatbot-Slack",
    "signingCertUrl": "https://sns.ap-northeast-1.amazonaws.com/SimpleNotificationService-9c6465fa7f48f5cacd23014631ec1136.pem",
    "messageId": "3d871d6b-3c13-546b-b266-7dcd1d6e9a45",
    "message": {
        "content": {
            "description": "hato Message"
        }
    },
    "subject": null,
    "unsubscribeUrl": "https://sns.ap-northeast-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:ap-northeast-1:123456789012:hato-sns-chatbot-Slack:***REDACTED***",
    "timestamp": "2025-06-01T01:01:01.011Z",
    "token": null
}

参考資料

Share this article

facebook logohatena logotwitter logo

© Classmethod, Inc. All rights reserved.