【问题标题】:Zapier Rest Hook Subscription - How to get target options?Zapier Rest Hook 订阅 - 如何获取目标选项?
【发布时间】:2020-01-03 23:25:21
【问题描述】:

我正在编写我的第一个与 Zapier 的 API 集成。我使用 REST 钩子创建了一个触发器,并且触发器正确触发,但我不确定如何确定用户在 Zapier 中选择的触发器选项。具体来说,我允许他们选择一个登陆页面,除非我知道他们想要激活哪个登陆页面,否则我不知道如何处理它,但我从 Zapier 得到的订阅结果如下:

{ "subscription_url": "https://hooks.zapier.com/hooks/standard/102653/94703dc5c31247c4acb8b82977fd08dc/", "target_url": "https://hooks.zapier.com/hooks/standard/102653/94703dc5c31247c4acb8b82977fd08dc/", “事件”:“登陆页面提交” }

我知道我可能遗漏了一些东西。我应该期望在某处找到在触发器下拉列表中选择的选项吗?还是我需要在 Zapier 端配置一些东西来处理它?

【问题讨论】:

    标签: rest zapier


    【解决方案1】:

    David 来自 Zapier 平台团队。

    如果我对您的理解正确,您只需从inputData 传递数据。

    在你的钩子订阅中,有一个地方可以传递数据(比如上面的"event")。您可以添加类似landing_page: bundle.inputData.landing_page 的内容。还有一个更完整的例子here

    const subscribeHook = (z, bundle) => {
    
      // bundle.targetUrl has the Hook URL this app should call when a recipe is created.
      const data = {
        url: bundle.targetUrl,
        style: bundle.inputData.style
      };
    
      // You can build requests and our client will helpfully inject all the variables
      // you need to complete. You can also register middleware to control this.
      const options = {
        url: 'http://57b20fb546b57d1100a3c405.mockapi.io/api/hooks',
        method: 'POST',
        body: JSON.stringify(data)
      };
    
      // You may return a promise or a normal data structure from any perform method.
      return z.request(options)
        .then((response) => JSON.parse(response.content));
    };
    

    【讨论】:

      猜你喜欢
      • 2018-07-26
      • 2015-12-10
      • 2021-02-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-04-08
      • 2016-01-08
      • 2020-01-07
      相关资源
      最近更新 更多