使用来自 twilio 无服务器函数的 flex api 创建通道
create channel with flex api from twilio serverless function
我正在尝试通过 nodejs twilio flex api 创建一个聊天频道,我可以从其他服务器或节点项目创建它,但是如果我将它部署在 twilio 的无服务器功能中,它会导致错误,似乎它不会'识别 flex api.
它给出错误无法读取 属性 创建未定义的。
twilio 功能还没有包含 flex api 吗?
代码如下:
const twilio = require('twilio')(context.ACCOUNT_SID, context.AUTH_TOKEN);
threadID=from
fromName=from
fromAddress=from
const channelArgs = {
flexFlowSid: 'FO.....',
identity: from,
chatUniqueName: from,
chatUserFriendlyName: from,
chatFriendlyName: from,
target: from,
preEngagementData: JSON.stringify({
threadID,
fromName,
fromAddress,
subject
})
};
twilio.flexApi.channel.create(channelArgs).then(channel => {
console.log('got chat channel', channel.sid);
验证您的 Twilio Functions 环境使用的 Twilio Helper Library 是最新的。
您可以在下面找到 twilio
的最新 Twilio 节点帮助程序库。
我正在尝试通过 nodejs twilio flex api 创建一个聊天频道,我可以从其他服务器或节点项目创建它,但是如果我将它部署在 twilio 的无服务器功能中,它会导致错误,似乎它不会'识别 flex api.
它给出错误无法读取 属性 创建未定义的。
twilio 功能还没有包含 flex api 吗?
代码如下:
const twilio = require('twilio')(context.ACCOUNT_SID, context.AUTH_TOKEN);
threadID=from
fromName=from
fromAddress=from
const channelArgs = {
flexFlowSid: 'FO.....',
identity: from,
chatUniqueName: from,
chatUserFriendlyName: from,
chatFriendlyName: from,
target: from,
preEngagementData: JSON.stringify({
threadID,
fromName,
fromAddress,
subject
})
};
twilio.flexApi.channel.create(channelArgs).then(channel => {
console.log('got chat channel', channel.sid);
验证您的 Twilio Functions 环境使用的 Twilio Helper Library 是最新的。
您可以在下面找到 twilio
的最新 Twilio 节点帮助程序库。