Messenger

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.

Properties

Type: messenger
Full type: Weavy.Areas.Apps.Models.Messenger
Guid: 42bd69cb-523e-415d-9794-1e53415a3e30

Code

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" 
});

Features

Direct messages

You can start a conversation with any other user and share messages, images, files instantly.

Group conversations

The same way as direct messages, you can create a group conversation with multiple users.

Mobile apps

The messenger is ready for mobile use with complete Messenger Android and iOS apps on Github that you may fork and customize for your own needs and your own branding. Read more about it in the Mobile Client SDK

https://github.com/Weavy/weavy-messenger-mobile

Badges

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);
});