Adding BBM Channels to your WebWorks App

Last month, Mark Sohm showed us how to Invoke a BBM Channel Within Your App with QML. Well, not to be outdone by my fellow native development consultants, I’m here to show you how to do the same and more today, with WebWorks!

With the ever-growing popularity of BBM Channels, you’re probably looking for a way to integrate the service into your applications. Luckily, using the Invocation Framework, you can easily view a BBM Channel and share content to it. Let’s take a look at the JavaScript.

Invoking a BBM Channel

Here, we’re simply building our ‘request’ object by setting a target, action, and channel uri. Then, we’re calling the blackberry.invoke.invoke() method. If the user is already subscribed to the Channel it will open, if the user is not subscribed they’ll be prompted to do so. Note that the BBM Channel is case sensitive.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

varrequest=

target:"sys.bbm.channels.card.previewer",

action:"bb.action.OPENBBMCHANNEL",

uri:"bbmc:C00124CF8"

;

blackberry.invoke.invoke(

request,

function()

console.log('success');

,

function(e)

console.log(e);

);

Sharing content

Below, is an example on how you would share a photo with a BBM Channel. Again, we’re just building our request object, giving it the path to a photo, and calling the blackberry.invoke.invoke() method. The Invocation Framework takes care of the rest!

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

<i>varrequest=</i>

<i>target:"sys.bbm.channels.sharehandler",</i>

<i>action:"bb.action.SHARE",</i>

<i>uri:"local:///test.gif"</i>

<i>;</i>

<i></i>

<i>blackberry.invoke.invoke(</i>

<i>request,</i>

<i></i>

<i>function()</i>

<i>console.log('success');</i>

<i>,</i>

<i></i>

<i>function(e)</i>

<i>console.log(e);</i>

<i></i>

<i>);</i>

You can also post text to a channel. It’s pretty much the same as the photo sharing, only you specify the mime-type and data properties instead of a photo uri.

Disclaimer: SDKNews.com only syndicates the blog entries from various SDK blogs.
We are not the creator/author of these entries (posts). Product names, brand names
and company names mentioned on this site may be trademarks of their respective owners.