我正在尝试使用 Zapier CLI 对触发器进行原型设计,并且在 UI 中设置触发器时遇到了“Pull In Samples”部分的问题。
这会尝试提取要使用的实时数据样本,但是文档指出,如果没有返回任何结果,它将使用为触发器配置的样本数据。
在大多数情况下,将没有实时数据,因此理想情况下实际上更喜欢在第一个实例中使用示例数据,但是我的触发器似乎从未使用过该示例,并且我无法找到一个具体示例“没有结果”的回应。
我使用的 API 返回 XML,因此我将结果处理为 JSON,如果有数据,它可以正常工作。
如果到目前为止没有结果,我尝试返回'[]',但这只是挂起,如果我检查 zapier http 日志,它会循环 http 请求,直到我取消样本检查。
返回 '[{}]' 返回一个错误,我需要一个 'id' 字段。
我使用的定义是:
module.exports = {
key: 'getsmsinbound',
noun: 'GetSMSInbound',
display: {
label: 'Get Inbound SMS',
description: 'Check for inbound SMS'
},
operation: {
inputFields: [
{ key: 'number', required: true, type: 'string', helpText: 'Enter the inbound number' },
{ key: 'keyword', required: false, type: 'string', helpText: 'Optional if you have configured a keyword and you wish to check for specific keyword messages.' },
],
perform: getsmsinbound,
sample: {
id: 1,
originator: '+447980123456',
destination: '+447781484146',
keyword: '',
date: '2009-07-08',
time: '10:38:55',
body: 'hello world',
network: 'Orange'
}
}
};
我希望这在搜索网络和 Zapier 文档时很明显,我没有任何运气!