1. Start an Instant Message Manually
Used to launch a new instant message to a particular user.
Execution only honored after up.events.ON_READY
| Argument | Description | Optional |
|---|---|---|
| userID | The userID of any user on your site. This is the same UserID value provided in your Single Sign On. | Yes |
Example
// Only call up.api.startInstantMessage after up.events.ON_READY has been fired.
imReady = false;
var startIM = function (userID) {
if ( imReady ) {
up.api.startInstantMessage( userID );
}
}
var onReady = function () {
// this will be executed as soon as Userplane is ready and enable your startIM method above.
imReady = true;
}
up.api.addEventListener( up.events.ON_READY, onReady ) ;
Another option to consider to launch conversations is the Badge component which will take care of all of this for you.