【问题标题】:Cognito Custom Message Trigger doesn't have any effectCognito 自定义消息触发器没有任何效果
【发布时间】:2020-04-23 12:23:24
【问题描述】:

我正在尝试使用自定义消息触发器自定义发送给用户预验证的消息,我验证了从 lambda 返回的数据是有效的并且修改是我想要的,但是似乎当我在我的电子邮件中收到标准验证详细信息时,这些更改没有生效

我在 aws 文档中找不到任何解决方案,有人遇到同样的问题吗?

    package main

import (
    "fmt"

    "github.com/aws/aws-lambda-go/events"
    "github.com/aws/aws-lambda-go/lambda"
)

// Handler will handle our request comming from the API gateway
func Handler(event events.CognitoEventUserPoolsCustomMessage) (events.CognitoEventUserPoolsCustomMessage, error) {

    if event.TriggerSource == "CustomMessage_SignUp" {
        event.Response.EmailMessage = "Welcome to myapp, please click the following link to verify your email, this is a custom message"
        event.Response.EmailMessage = fmt.Sprintf(`Please click the link below to verify your email address. https://apigateway.myapp.com/auth/validate?client_id=%s&user_name=%s&confirmation_code=%s`, event.CallerContext.ClientID, event.UserName, event.Request.CodeParameter)
    }

    return event, nil
}

func main() {
    lambda.Start(Handler)
}

【问题讨论】:

    标签: amazon-web-services go amazon-cognito


    【解决方案1】:

    似乎在消息自定义下的认知面板中需要检查验证类型代码(不是链接),在我这样做之后,触发器确实改变了消息

    【讨论】:

    • 嘿@Smail,我面临同样的问题.. 没有得到这个选项“类型代码”在你提到的消息自定义选项卡上的位置。你能帮我找到那个吗?
    • 您好抱歉回答晚了,如果可以帮助您有验证类型和单选按钮代码或链接...您需要选择代码
    • 多么令人愤怒的要求。无论选择代码还是链接都无关紧要,因为我们正在自定义发送的消息。此外,如果文本中不存在正确的字符串,它只是默默地失败?!真是笑话。但是,谢谢你的回答。
    【解决方案2】:

    它也适用于验证链接,但您必须在用户池 - 消息自定义设置中使用代码参数作为 {##Verify email##} 而不是 {####}。然后在你的 html 模板中使用 {##Verify email##} 关键字。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-05-30
      • 2019-08-07
      • 2018-06-17
      • 2019-11-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-12-28
      相关资源
      最近更新 更多