问题描述
在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 (自定义字段)或联系人中关闭}
。