【发布时间】:2023-01-17 16:58:14
【问题描述】:
我搜索了 Twilio Studio 的文档,但没有找到有关发送 Interactive Messages 或从位置消息接收纬度和经度的任何信息。对于后者,我发现非官方提到了 Twilio Studio 不支持位置信息。
Twilio Studio 当前是否支持交互式消息和位置信息?如果没有,是否有实施支持他们的计划?当前是否有解决方法,特别是关于获取位置信息?
非常感谢。
我尝试过哪些解决方法
在位置信息的情况下:
我尝试在 Studio 中运行调用 Twilio 函数,该函数接收位置并在回复中回显坐标。连接到 Whatsapp 沙盒的函数本身有效,但在 Twilio Flow 内部调用时无效。
我假设函数在从 Studio Flow 调用时无法访问事件参数。
exports.handler = function(context, event, callback) {
let twiml = new Twilio.twiml.MessagingResponse();
if (!event.Latitude || !event.Longitude) {
twiml.message("Send a location.");
callback(null, twiml);
} else {
const location = {
lat: event.Latitude,
lon: event.Longitude
};
twiml.message(
`${location.lat}, ${location.lon}`
);
callback(null, twiml);
}
};
(代码最初取自this教程。)
编辑:
这很尴尬,但我想出了如何访问纬度和经度信息。
只需访问以下 Liquid 变量
{{widgets.send_and_reply_1.inbound.Longitude}}
{{widgets.send_and_reply_1.inbound.Latitude}}
(通过正确节点的名称更改 send_and_reply。)
【问题讨论】:
标签: javascript twilio twilio-studio