Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

mstdmstd's avatar

With twilio API in vuejs2 app I got error

Hello, I want to use twilio API in my vuejs2 app looking at demo https://github.com/TwilioDevEd/sdk-starter-node:

I try to follow it and read token backendpoint, which looks like “eyJ0eXAiO...” and I try next :

...
const Twilio = require('twilio')

console.log('$twilio::')
console.log(Twilio)

console.log('$twilio.Chat::')
console.log(Twilio.Chat)

const client = await Twilio.Chat.Client.create(token)

I got error :

TypeError: Cannot read property 'Client' of undefined

and in console I see invalid twilio object : https://prnt.sc/w41cc7

I suppose I imported invalid twilio object, but how correctly ? looks like in the sdk-starter-node-master was done in the same way and I do not see difference?

package.json :

"axios": "^0.19.0",
"core-js": "^3.3.2",
...
"twilio": "^3.54.0",
"vue": "^2.6.10",
...

Thanks!

0 likes
5 replies
mstdmstd's avatar

by your link in code :

const Chat = require('twilio-chat');
Chat.Client.create(token).then(client => {

token must be provided... Where can I get it from ?

mstdmstd's avatar

Thanks, I saw such scripts and tried to follow them. It seems to me that there was a reference to some very old version of API and I do not see why...

Please or to participate in this conversation.