The messenger app provides instant messaging for users of your application. It has full emoji support and contains features such as file and image attachments.
The messenger app provides instant messaging for users of your application. It has full emoji support and contains features such as file and image attachments.
Type: messenger
Full type: Weavy.Areas.Apps.Models.Messenger
Guid: 42bd69cb-523e-415d-9794-1e53415a3e30
To create a new messenger app from the client, you use the Object definifion syntax to create it. You need to specify key, type and optionally the container where to place it and a name.
var weavy = new Weavy();
var messenger = weavy.space("my_space_key").app({
key: "my_messenger_key",
name: "Messenger",
type: "messenger",
container: "#mymessengercontainer"
});
The Client provides an event which provides the number of unread conversations. This event gets triggered whenever a new message is receivied. It is useful to for instance place a badge on an icon you use to toggle the messenger app.
Event: "badge"
Data: data.conversations
var weavy = new Weavy();
function setBadge(selector, count) {
if (count > 0) {
var $badge = $(selector + " .badge");
if ($badge.length) {
$badge.text(count);
} else {
$('<span class="badge">' + count + '</span>').appendTo(selector);
}
} else {
$(selector + " .badge").remove();
}
}
weavy.on("badge", function (e, data) {
setBadge("#weavyMessengerButton", data.conversations);
});