微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Zapier Javascript:意外令牌]

如何解决Zapier Javascript:意外令牌]

在Zapier Zap中,我正在从Google表格中提取数据,并使用JS进行美化,以便稍后发送电子邮件。我碰到以下错误消息:

SyntaxError:意外令牌]

我在zap中的代码

const data = {
    "list_ids": [
    "a0b30126-69d6-4822-ac06-bf76c3ff4770"
    ],"contacts": [
    {
        "email": "email","first_name": "name","custom_fields": {
        "e5_T": "list","e6_T": "y","e7_T": "z"
    }
    ]
}

const res = await fetch('https://api.sendgrid.com/v3/marketing/contacts',{
    method: 'PUT',headers: {
        'Content-Type': 'application/json','authorization': 'Bearer <<my api key>>'
    },body: JSON.stringify(data),})

.then(response => response.json())
.then(data => {
    console.log('Success:',data);
    })
.catch((error) => {
    console.error('Error:',error);
    });

return { res };

我使用了来自该博客https://joelaguero.com/how-to-add-a-sendgrid-contact-with-zapier-code-snippets/代码。作者说这对他有用。

解决方法

这是因为您的{}多。 您可能忘记了在 custom_fields 自定义字段)或联系人中关闭}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。