使用twilio serverless函数中的flex api创建通道



我正在尝试通过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函数环境使用的Twilio Helper库是最新的。

您可以在下面找到适用于twilio的最新Twilio节点帮助程序库。

twilio节点变更日志

最新更新