zapier - 为什么我的 Zapier 集成动态字段不起作用?

标签 zapier

我构建了一个简单的 zapier 集成,并且运行良好。但是,我正在添加动态字段。当我测试 zap 时,一切似乎都完美地工作。我的动态表单字段正如我预期的那样显示。

问题是将这些动态表单的值发送到我的 API。我正在使用 zapier 控制台,当我配置 API 请求时,我使用以下内容:

其中 body['custom_fields'] 应该发送我的所有动态字段甚至所有字段。但是当它到达我的 API custom_fields 参数时,它是空白的。

const options = {
  url: 'https://example_url/endpoint',
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Accept': 'application/json',
    'Authorization': `Bearer ${bundle.authData.auth_token}`
  },
  body: {
    'email': bundle.inputData.email,
    'custom_fields': bundle.inputData

    /**
      I've tried the following with no luck:

     'custom_fields': bundle.inputData.fields
     'custom_fields': bundle.inputData.undefined
     'custom_fields': bundle.inputData
    */
  }
}

return z.request(options)
  .then((response) => {
    response.throwForStatus();
    const results = response.json;

    // You can do any parsing you need for results here before returning them

    return results;
  });

最佳答案

好吧,几天后,这是最简单的答案。

显然,对象不能通过参数发送。

所以而不是

'custom_fields': bundle.inputData

我只是将整个对象添加到参数中,它会处理所有键和值

params: bundle.inputData

这是全身

const options = {
  url: 'https://apiendpoint.com',
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${bundle.authData.auth_token}`
  },
  params: bundle.inputData,

}

return z.request(options)
  .then((response) => {
    response.throwForStatus();
    const results = response.json;

    // You can do any parsing you need for results here before returning them

    return results;
  });

关于zapier - 为什么我的 Zapier 集成动态字段不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61603815/

相关文章:

javascript - 如何使用 Zapier 获取 JSON 数组中的第一个值?

firebase - 协作者电子邮件邀请的安全性

javascript - 使用 JavaScript 获取外部页面的 <title>

javascript - 如何使用 Zapier 的 Twitter API 进行身份验证?

javascript - 将信息发布到 2 个区域。 PHP/Javascript

security - Zapier Twilio 凭据存储 : how safe is that?

python - 在 Zapier 中使用此代码时,为什么会出现 Runtime.MarshalError?

javascript - 在 Zapier 代码上使用外部 javascript 库或 SDK

slack-api - 带有 Zapier 的 slacks 斜杠命令中的多个参数

node.js - 从 Zapier 创建文件