I'm looking into ways to open a chat window with a user via the API.
I have set up (and registered in the whitelist) a plugin, which triggers.
converse.plugins.add('startChat', {
initialize: function () {
this._converse.on('connected', function () {
console.log("wibble");
this._converse.api.chats.open('user@chat.domain.com');
});
}
});
This is firing, but no chat is initiated. I get the following errors in console:
wibble
converse.js:48049
FATAL: TypeError: Cannot read property 'get' of undefined
at child.createChatBox (/converse.js:50015:56)
at child.getChatBox (/converse.js:50050:40)
at Object.open (/converse.js:50153:84)
at Object.<anonymous> (Page.aspx:1264:41)
at triggerEvents (/converse.js:46015:57)
at triggerApi (/converse.js:46003:19)
at eventsApi (/converse.js:45802:16)
at Object.Events.trigger (/converse.js:45993:5)
at Object._converse.emit (/converse.js:48071:27)
at Object.onConnected (/converse.js:48671:27)
converse.js:48041
ERROR: User connection callback caused an exception: TypeError: Cannot read property 'get' of undefined