AWS Cognito用户池的事件触发器对象

时间:2016-07-11 03:16:25

标签: node.js amazon-web-services aws-lambda amazon-cognito

我想在我的AWS Cognito用户池

中为新注册的用户制作自定义验证消息

为此,我尝试将Lamda函数与“自定义消息”触发器相关联。

但是,我无法找到自定义消息事件的确切格式,以便能够创建我的lambda函数。

我想出的lambda函数是

{  "version": 1,
  "triggerSource": "RegisterUser/ResendCode/ForgotPassword/VerifyUserAttribute",
  "region": "<region>",
  "userPoolId": "<userPoolId>",
  "userName": "<userName>",
  "callerContext": {
      "awsSdk": "<calling aws sdk with version>",
      "clientId": "<apps client id>",
      ...
  },
  "request": {
      "userAttributes": {
          "phone_verified": true/false,
          "email_verified": true/false,
          ... (all custom attributes)
      },
      "codeParameter": "{code}"
  },
  "response": {
      "smsMessage": "<custom message to be sent in the message with code parameter>"
      "emailMessage": "<custom message to be sent in the message with code parameter>"
      "emailSubject": "<custom email subject>"
  }
}

当我在Lambda控制台中“测试”我的功能时,它可以工作,但这是因为我根据我在文档中找到的唯一线索,根据我自己创建的事件对象对其进行测试:

router.get('/api/comments', testFunction);

来自https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-identity-pools-working-with-aws-lambda-triggers.html

我需要比这更坚实的东西。我无法让我的功能工作,我不知道从哪里开始。如果我不知道在事件对象中会发生什么,我该如何实现lambda函数? “自定义消息”事件是否有任何规范?

更新: 既然亚马逊用户池已经过测试版,那么自2016年7月29日起,我不再遇到这个问题了。

1 个答案:

答案 0 :(得分:0)

好像以前的文档中有错误。你可以尝试使用triggerSource名称作为“CustomMessage_SignUp”。您还可以查看示例的更新文档。

相关问题