Zapier CLI 如何使用 trigger_fields
Zapier CLI how to use trigger_fields
如何替换触发器 url 中的 path param
模板?
这是我当前的代码,但我收到一条错误消息,指出
"The client {{client_id}} doesn't exist."
我认为 {{client_id}}
模板没有被替换,这是我的代码:
const listEvents = (z, bundle) => {
console.log('listing events.. ');
const requestOpts = {
url: 'https://wccqa.on24.com/wcc/api/v2/client/{{client_id}}/event',
params: {
client_id: bundle.inputData.client_id
}
};
var eventResults = z.request(requestOpts)
.then((response) => z.JSON.parse(response.content));
z.console.log(eventResults);
return eventResults;
};
module.exports = {
//config ...
}
params: {client_id: bundle.inputData.client_id}
不替换这个模板吗?
此外,有时 运行 zapier test
:
时会出现以下错误
1) GetEvents trigger testing should load latest Event created:
Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
来自 Zapier Platform 团队的 David。
你是对的,如所写,curl没有被替换。它们仅在您使用 shorthand notation 时才被替换,这在这里可能对您有用。
否则,您可以使用regular requests。
最简单的方法是使用 template strings:
构建您的 url
const url = `https://wccqa.on24.com/wcc/api/v2/client/${bundle.inputData.client_id}/event`
其他一切看起来都会如您所愿。
如何替换触发器 url 中的 path param
模板?
这是我当前的代码,但我收到一条错误消息,指出
"The client {{client_id}} doesn't exist."
我认为 {{client_id}}
模板没有被替换,这是我的代码:
const listEvents = (z, bundle) => {
console.log('listing events.. ');
const requestOpts = {
url: 'https://wccqa.on24.com/wcc/api/v2/client/{{client_id}}/event',
params: {
client_id: bundle.inputData.client_id
}
};
var eventResults = z.request(requestOpts)
.then((response) => z.JSON.parse(response.content));
z.console.log(eventResults);
return eventResults;
};
module.exports = {
//config ...
}
params: {client_id: bundle.inputData.client_id}
不替换这个模板吗?
此外,有时 运行 zapier test
:
1) GetEvents trigger testing should load latest Event created: Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
来自 Zapier Platform 团队的 David。
你是对的,如所写,curl没有被替换。它们仅在您使用 shorthand notation 时才被替换,这在这里可能对您有用。
否则,您可以使用regular requests。
最简单的方法是使用 template strings:
构建您的 urlconst url = `https://wccqa.on24.com/wcc/api/v2/client/${bundle.inputData.client_id}/event`
其他一切看起来都会如您所愿。