Zapier:如何使用 Zapier 从 ScheduleOnce 向我的 Node.js 网络应用程序发送数据
Zapier: How to send data to my Node.js web app from ScheduleOnce using Zapier
这是我的工作流程:
- 有人点击我的 ScheduleOnce link 并安排会议
- 完成 ScheduleOnce 预订表格后,此人单击完成按钮
- 单击此完成按钮后,用户将被重定向到显示应用程序页面的 Node JS Web 应用程序。此应用程序页面需要 auto-populated 包含来自 ScheduleOnce 页面的信息。
在第 2 步和第 3 步之间是 Zapier 的用武之地。我正在尝试使用 Zapier 从 ScheduleOnce 预订中捕获数据,它就是这样。然后我尝试使用 Zap 将该数据发送到该人被重定向到的页面,发送到 auto-populate 一些字段。
我认为使用代码 Javascript 功能会起作用,但它不起作用。所以我在考虑使用 StoreClient 选项或 API。我只是对如何让流程工作以访问数据和 auto-populate 下一个重定向页面上的字段感到困惑。
不胜感激。
这是我为 Javascript 选项准备的代码:
var store = StoreClient("Secret");
store
.setMany({firstName: inputData.firstName, lastName: inputData.lastName, email: inputData.email, mobilePhone: inputData.mobilePhone, otherPhone: inputData.otherPhone, businessWebsite: inputData.businessWebsite})
.then(function() {
return store.getMany('firstName', 'lastName', 'email', 'mobilePhone', 'otherPhone', 'businessWebsite');
})
.then(function() {
callback();
})
.catch(callback);
来自 Zapier Platform 团队的 David。这是一个很酷的用例,可能是可行的。您需要记住的是,Zapier 运行 与用户完全分开,因此交互必须是间接的。 Zapier 无法将您的用户重定向到任何地方,它只能存储数据以响应按钮按下。
在您的情况下,您可以跳过 setMany
之后的所有内容,因为您不想使用 zap 中的值;您只需要存储它们(并验证操作是否已完成且没有错误)。
var store = StoreClient("Secret");
store
.setMany({firstName: inputData.firstName, lastName: inputData.lastName, email: inputData.email, mobilePhone: inputData.mobilePhone, otherPhone: inputData.otherPhone, businessWebsite: inputData.businessWebsite})
.catch(callback);
您需要解决几个问题:
- 速度。用户将在 zap 完成之前到达您的登录页面(因为它必须进行几次 HTTP 往返并执行代码)。你会想给他们播放一个 3 秒的加载 gif,或者放一条等待消息并允许他们刷新目的地
- 正在填充页面。我不确定目的地的性质是什么(最好的情况是它是您控制的服务器),但是需要向
store.zapier.com
发出 http 请求以检索存储的数据并将其显示在看法。如果 这很容易
- 识别用户。您需要一些方法来识别被重定向到存储在 StoreClient 中的数据的用户。如果两个用户快速连续填写表单,则第二个用户当前将覆盖第一个。另外,它似乎是半敏感数据,您不希望网站上的任何人都可以访问这些数据。为此,您可能希望将所有数据存储为 JSON 字符串,由用户的电子邮件(或其他唯一的东西)键入。这样,当我(用户)完成表单时,我被重定向到
yoursite.com/landing?email=david@zapier.com
,后端知道要查找(存储中的 david@zapier.com
键)并且可以呈现具有正确信息的视图.
为此,我将代码调整为以下内容:
var store = StoreClient("Secret");
store
.set(inputData.email, JSON.stringify({firstName: inputData.firstName, lastName: inputData.lastName, email: inputData.email, mobilePhone: inputData.mobilePhone, otherPhone: inputData.otherPhone, businessWebsite: inputData.businessWebsite}))
.catch(callback);
希望这能为您指明正确的方向。您正在处理一个相当复杂的工作流程,但我敢打赌您可以做到!
这是我的工作流程:
- 有人点击我的 ScheduleOnce link 并安排会议
- 完成 ScheduleOnce 预订表格后,此人单击完成按钮
- 单击此完成按钮后,用户将被重定向到显示应用程序页面的 Node JS Web 应用程序。此应用程序页面需要 auto-populated 包含来自 ScheduleOnce 页面的信息。
在第 2 步和第 3 步之间是 Zapier 的用武之地。我正在尝试使用 Zapier 从 ScheduleOnce 预订中捕获数据,它就是这样。然后我尝试使用 Zap 将该数据发送到该人被重定向到的页面,发送到 auto-populate 一些字段。
我认为使用代码 Javascript 功能会起作用,但它不起作用。所以我在考虑使用 StoreClient 选项或 API。我只是对如何让流程工作以访问数据和 auto-populate 下一个重定向页面上的字段感到困惑。
不胜感激。
这是我为 Javascript 选项准备的代码:
var store = StoreClient("Secret");
store
.setMany({firstName: inputData.firstName, lastName: inputData.lastName, email: inputData.email, mobilePhone: inputData.mobilePhone, otherPhone: inputData.otherPhone, businessWebsite: inputData.businessWebsite})
.then(function() {
return store.getMany('firstName', 'lastName', 'email', 'mobilePhone', 'otherPhone', 'businessWebsite');
})
.then(function() {
callback();
})
.catch(callback);
来自 Zapier Platform 团队的 David。这是一个很酷的用例,可能是可行的。您需要记住的是,Zapier 运行 与用户完全分开,因此交互必须是间接的。 Zapier 无法将您的用户重定向到任何地方,它只能存储数据以响应按钮按下。
在您的情况下,您可以跳过 setMany
之后的所有内容,因为您不想使用 zap 中的值;您只需要存储它们(并验证操作是否已完成且没有错误)。
var store = StoreClient("Secret");
store
.setMany({firstName: inputData.firstName, lastName: inputData.lastName, email: inputData.email, mobilePhone: inputData.mobilePhone, otherPhone: inputData.otherPhone, businessWebsite: inputData.businessWebsite})
.catch(callback);
您需要解决几个问题:
- 速度。用户将在 zap 完成之前到达您的登录页面(因为它必须进行几次 HTTP 往返并执行代码)。你会想给他们播放一个 3 秒的加载 gif,或者放一条等待消息并允许他们刷新目的地
- 正在填充页面。我不确定目的地的性质是什么(最好的情况是它是您控制的服务器),但是需要向
store.zapier.com
发出 http 请求以检索存储的数据并将其显示在看法。如果 这很容易
- 识别用户。您需要一些方法来识别被重定向到存储在 StoreClient 中的数据的用户。如果两个用户快速连续填写表单,则第二个用户当前将覆盖第一个。另外,它似乎是半敏感数据,您不希望网站上的任何人都可以访问这些数据。为此,您可能希望将所有数据存储为 JSON 字符串,由用户的电子邮件(或其他唯一的东西)键入。这样,当我(用户)完成表单时,我被重定向到
yoursite.com/landing?email=david@zapier.com
,后端知道要查找(存储中的david@zapier.com
键)并且可以呈现具有正确信息的视图.
为此,我将代码调整为以下内容:
var store = StoreClient("Secret");
store
.set(inputData.email, JSON.stringify({firstName: inputData.firstName, lastName: inputData.lastName, email: inputData.email, mobilePhone: inputData.mobilePhone, otherPhone: inputData.otherPhone, businessWebsite: inputData.businessWebsite}))
.catch(callback);
希望这能为您指明正确的方向。您正在处理一个相当复杂的工作流程,但我敢打赌您可以做到!