Zapier Javascript:意外标记]
在Zapier-Zap中,我从Google表单中提取数据,并使用JS对其进行修饰,以便稍后发送电子邮件。我遇到以下消息错误: SyntaxError:意外标记] 我的zap代码Zapier Javascript:意外标记],javascript,sendgrid,zapier,Javascript,Sendgrid,Zapier,在Zapier-Zap中,我从Google表单中提取数据,并使用JS对其进行修饰,以便稍后发送电子邮件。我遇到以下消息错误: SyntaxError:意外标记] 我的zap代码 const data = { "list_ids": [ "a0b30126-69d6-4822-ac06-bf76c3ff4770" ], "contacts": [ { "email"
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 };
const数据={
“列表ID”:[
“a0b30126-69d6-4822-ac06-bf76c3ff4770”
],
“联系人”:[
{
“电子邮件”:“电子邮件”,
“名字”:“名字”,
“自定义字段”:{
“e5_T”:“列表”,
“e6_T”:“y”,
“e7_T”:“z”
}
]
}
const res=等待取数('https://api.sendgrid.com/v3/marketing/contacts', {
方法:'放',
标题:{
“内容类型”:“应用程序/json”,
“授权”:“持票人”
},
正文:JSON.stringify(数据),
})
.then(response=>response.json())
。然后(数据=>{
console.log('Success:',data);
})
.catch((错误)=>{
console.error('error:',error);
});
返回{res};
我使用了这个博客上的代码。作者说它对他有用。这是因为你的
{
比}
多。
您可能忘记了在自定义字段中关闭
,或者在联系人中关闭调试器说错误出现在代码的哪一行?“自定义字段”
没有关闭