如何使用javascript(node.js)在Sendgrid v3中动态设置链接

时间:2019-04-29 02:31:54

标签: hyperlink sendgrid sendgrid-api-v3 sendgrid-templates

我正在尝试向sendgrid模板添加唯一链接,但是到目前为止我还没有运气。 sendgrid中的按钮如下:

File imgFile = new File("/res/drawable/adorable-animal-cat-20787.jpg");

我也尝试过:

<a href="-org_url-" target="_blank">Accept</a>

我的javascript函数如下:

 <a href="{{org_url}}" target="_blank">Accept</a>

在检查已发送的电子邮件时,href字段为空或仅包含-org_url-。如何传递正确的链接?谢谢!

2 个答案:

答案 0 :(得分:0)

假设您正在使用SendGrid's v3 API(如果您使用的是他们的媒体库,则使用的是the full format),则需要确保在Personalization参数内传递Substitution参数。

如果您不使用库而是手动建立呼叫,则需要遵循https://github.com/Mushy-pea/Game-Dangerous/blob/master/Game_logic.hs或实现库。

答案 1 :(得分:0)

您可以编辑模块html代码并使用字符串插值插入车把。

monitorMsg(){this.firechats.child(userId).child(toUserId).orderByChild("time").startAt(time).on('value', (snapshot) => {
              console.log("why this happen?????????")
              console.log(snapshot)
            });}



sendMsg(){
var promise = new Promise((resolve, reject) => {
      this.firechats.child(userId).child(toUserId).push().set(msg).then(() => {
        console.log("send msg to firebase")
      }).catch((err)=>{
        console.log("send to toUserId failed")
        reject(err)
      })
    })
}