Closed premjo closed 5 years ago
Hi, I have used this on Ionic 3 yesterday and it worked out correctly. Same config as you, but called within the platform.deviceReady() callback
Yeah! i'm calling the function within platform.deviceReady callback only app.component.ts. When i'm trying to call the function showConversation. Its throwing error saying "please invoke the init method first before call the showConversation method". So i'have called the init method once again from inside the constructor of page but i'm still getting the below error. Error: Uncaught (in promise): TypeError: Cannot read property 'init' of undefined TypeError: Cannot read property 'init' of undefined.
Browser does not support the plugin. I'm only getting that message within the browser. Is that the case? I've if conditioned myself out of it.
Yeah i have done the same. Since it wont work in browser. But mobile app is not responding as expected to debug i have added the device to chrome://inspect (USB Enable Debugging). If i check through mobile i'm not getting any response. Can you please add the screen if you call method showConversation or showFAQs method any of page. Just to know what would be response.
Hi @alan-grixti @techaffinity , Any updates on this issue.
You can access Freshchat object like this (window as any).Freshchat.init({ appId : "", appKey : "" }); });
Please refer readme for ionic .
Re-installing FreshchatSDK the application crash issue got resolved.
But after navigated conversation page it keeps loading.
Error log 2018-06-07 11:30:06.159840+0530 chat[36023:643634] ionViewDidLoad LandingPage 2018-06-07 11:30:11.362617+0530 chat[36023:643634] THREAD WARNING: ['freshchatPlugin'] took '1461.916016' ms. Plugin should use a background thread. 2018-06-07 11:30:11.363260+0530 chat[36023:643634] ionViewDidLoad FreshChatPage 2018-06-07 11:30:12.808795+0530 chat[36023:644364] TIC TCP Conn Failed [1:0x600000172f00]: 12:8 Err(-65554) 2018-06-07 11:30:12.828142+0530 chat[36023:644516] Task <60E1FF62-2FE5-4F62-A17F-321E0E944B91>.<1> HTTP load failed (error code: -1003 [12:8]) 2018-06-07 11:30:12.828553+0530 chat[36023:644364] Task <60E1FF62-2FE5-4F62-A17F-321E0E944B91>.<1> finished with error - code: -1003 2018-06-07 11:30:12.867100+0530 chat[36023:644516] HOTLINE: Channels updated
First call (window as any).Freshchat.init({ appId : "", appKey : "" }); }); After the successfuly initialized .Then you call method showConversation or showFAQs.
i followed the steps here https://github.com/techaffinity/freshchat-phonegap used this to resolve the issue still same error my code https://codeshare.io/5ovJ9b
my cordovaa cersion is 8.0 i tried to create a sample cordova project & load the freshchat plugin
it shows an error occured while trying to load the resource
`function showFreshChat() { console.log("freshchat"); var profile = JSON.parse(localStorage.getItem('profile')); console.log(profile);
if(wGlobal.platform == '') { window.fcWidget.init({
token : "",
host : "https://wchat.freshchat.com",
externalId : profile.username, // user’s id unique to your system
firstName : profile.first_name, // user’s first name
lastName : profile.last_name, // user’s last name
email : profile.email, // user’s email address
phone : profile.userprofile.phone_number, // phone number without country code
phoneCountryCode: "+91",
restoreId : localStorage.getItem('freshchatrestotreId'+profile.username),
config : {
headerProperty:
{
//Set Widget to be left to right.
direction: 'ltr'
}
}
});
window.fcWidget.user.get(function(resp)
{
var status = resp && resp.status,
data = resp && resp.data;
if (status !== 200)
{
window.fcWidget.user.setProperties({
firstName : profile.first_name, // user’s first name
lastName : profile.last_name, // user’s last name
email : profile.email, // user’s email address
phone : profile.userprofile.phone_number, // phone number without country code
phoneCountryCode: "+91",
plan : "Estate", // user's meta property 1
status : "Active", // user's meta property 2
});
window.fcWidget.on('user:created', function(resp)
{
var status = resp && resp.status,
data = resp && resp.data;
if (status === 200) {
if (data.restoreId)
{
localStorage.setItem("freshchatrestotreId"+profile.username, data.restoreId);// Update restoreId in your database
}
}
});
}
});
}// end of freshat initiallization for lite app
else
{
document.addEventListener("deviceready",function(){
window.Freshchat.init({
appId : "",
appKey : "",
gallerySelectionEnabled : true,
cameraCaptureEnabled : true,
teamMemberInfoVisible : true,
config : {
headerProperty:
{
//Set Widget to be left to right.
direction: 'ltr'
}
}
}, function(success){
console.log("This is called form the init callback");
});
//After initializing Freshchat in ios
showSupportChat = function()
{
var userInfo = {
"name" : profile.first_name + ' ' + profile.last_name,
"email" : profile.email,
"externalId" : profile.username,
"countryCode" : "+91",
"phoneNumber" : profile.userprofile.phone_number
};
Freshchat.updateUser(userInfo)
window.Freshchat.showConversations();
};
document.getElementById("launch_conversations").onclick = showSupportChat;
});
} // end of initiallization for ios
console.log('opened fresh chat');
} //end of Freshchat ` when i try to add the plugin from the command specified in steps it showed this error
Jays-MacBook-Pro:hello jay$ sudo cordova plugin add https://github.com/techaffinity/freshchat-phonegap.git (node:6762) UnhandledPromiseRejectionWarning: CordovaError: Failed to fetch plugin https://github.com/techaffinity/freshchat-phonegap.git via registry. Probably this is either a connection problem, or plugin spec is incorrect. Check your connection and plugin name/version/URL. Error: npm: Command failed with exit code 1 Error output: npm ERR! code 1 npm ERR! Command failed: /usr/local/bin/git clone -q https://github.com/techaffinity/freshchat-phonegap.git /Users/jay/.npm/_cacache/tmp/git-clone-045cb2e1 npm ERR! /Users/jay/.npm/_cacache/tmp/git-clone-045cb2e1/.git: Permission denied npm ERR!
npm ERR! A complete log of this run can be found in: npm ERR! /Users/jay/.npm/_logs/2018-07-06T07_07_33_337Z-debug.log at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/fetch.js:173:37 at _rejected (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:864:24) at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:890:30 at Promise.when (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:1142:31) at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:808:41) at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:624:44 at runSingle (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:137:13) at flush (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:125:13) at _combinedTickCallback (internal/process/next_tick.js:131:7) at process._tickCallback (internal/process/next_tick.js:180:9) (node:6762) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:6762) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
so i added the plugin locally
Hi premjio
We can access Freshchat SDK in mobile app only. Initially, call (window as any).Freshchat.init({ appId : "", appKey : "" }); }); Once it is successfuly initialized, you should make a call to showConversation or showFAQs.
Hi wishbooks Please refer #15 for the issue you mentioned. Thanks
I wanted to integrate the freshchat for ionic app.
I have initiated the FreshChat as below mention. window.Freshchat.init({ appId : "",
appKey : "",
gallerySelectionEnabled : true,
cameraCaptureEnabled : true,
teamMemberInfoVisible : true
});
I'm trying to pop out the conversation channel. But its not working..
window.Freshchat.showConversations();
Is that plugin will support for IONIC framework ?
Please let me know, if i have missed any configuration stuff.