twilio / cordova-plugin-twilio-chat

Twilio Programmable Chat Cordova plugin
https://www.twilio.com/chat
11 stars 6 forks source link

Integrate with Ionic 3/4 documentation #1

Open hanatharesh2712 opened 5 years ago

hanatharesh2712 commented 5 years ago

Hi, Can you provide documentation for how to integrate the plugin in Ionic 3/4? It would help a lot! Thanks!

colonelpopcorn commented 4 years ago

@hanatharesh2712 Have you been able to use this with Ionic 4? We're looking at adding it into our project, but we don't want to spin our wheels if it's not ready for primetime.

hanatharesh2712 commented 4 years ago

@colonelpopcorn I am using this plugin with Ionic 3. but, I haven't tried this with Ionic 4. Thanks!

colonelpopcorn commented 4 years ago

I was able to follow Twilio's Cordova example to get the basics working. It's not exactly necessary to use the plugin since it's all just JavaScript in the repository. npm install -P twilio-chat will allow you to import it into your ionic app. I did have to patch the twilsock package with a check for window instead of global not sure if what I did was correct, but it works.

chakri3130 commented 4 years ago

@colonelpopcorn in which version of ionic added "npm install -P twilio-chat" is it Ionic 4?.Please help me I am facing lot of errors after installations in ionic 4. Thanks in Advance.

chakri3130 commented 4 years ago

I am unable to import cordova-plugin-twilio-chat in ionic4. Can anyone help me. Thanks in advance.

hanatharesh2712 commented 4 years ago

@chakri3130 You can add the npm package and initialize Twilio client like this: public Twilio: any = (<any>window).TwilioChat;

and then you can perform all the operations. You can find a reference from this ionic app. https://github.com/ASASCED/koomkin-app/blob/7f79bae9cda12870d1edbb957fea67de1d7498d2/src/providers/chat-service/chat-service.ts

hanatharesh2712 commented 4 years ago

I was able to follow Twilio's Cordova example to get the basics working. It's not exactly necessary to use the plugin since it's all just JavaScript in the repository. npm install -P twilio-chat will allow you to import it into your ionic app. I did have to patch the twilsock package with a check for window instead of global not sure if what I did was correct, but it works.

the Cordova plugin should provide an offline feature. so, we can send and receive messages when the user goes online.