Reputation: 103
I am trying t ocreate a chat channel through nodejs twilio flex api, I can create it from other server or node project, but if I deploy it in twilio's serverless function it causes error ,seems it doesn't recognize flex api.
It gives error can not read property create of undefined.
Does twilio function has not included flex api yet?
code is as below:
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);
Upvotes: 0
Views: 217
Reputation: 10781
Verify the Twilio Helper Library in use by your Twilio Functions environment is up to date.
You can find the most up to date Twilio Node Helper Library for twilio
is below.
Upvotes: 1