Introducing the Social Connector

We know how important it is to share, share whatever comes to our minds no matter what it is for. We have released a new feature called “Social Connector”, this will allow our users to share content from their iKnode apps to Social Accounts, with the simplicity of 2 lines of code. Right now we are supporting Twitter and Facebook services, we allow our users to post tweets or content to the user Facebook feed.

It is also very easy to set this up, once you are in Command Center locate the section called “Social Connector”:

This will display on the right panel two buttons

Each of those buttons will begin the traditional authentication/authorization process, if you are already logged on those services you will just have to authorize our app, otherwise you will have to authenticate against the service first, what it is going to happen is that we are going to store your access tokens in your user storage, the collection will be called social media, so you can just look at it right away after you authorize iKnode to access your social accounts.

If you have multiple accounts, iKnode will handle that by naming your token records so you can choose which one to use in your apps. This is how the records will look like:

among other columns, you should see the ones shown below, of course you will a token string for each document (record) in the collection. What you should consider is the column name, on your apps you would refer to this tokens by the name, so let’s say if you wanted to post some random message to one of your twitter accounts, you would have to use the name of the token record to use, you can of couse edit the document and change the name to whatever you like, something that would make more sense to you than twitter1, twitter2, etc.

Now, how to use this? easy, take a look at the iKnode app shown below, your apps method ‘Shout’ will try to post a message (provided as a parameter) to facebook and twitter, we will make use of our twitter and facebook accounts, twitter1 and facebook1 respectively.

Social Poster iKnode Application
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
using System;
using iKnode.Applications;
using iKnode.Applications.Social.Clients;

namespace Applications
{
    [Application]
    public class SocialPoster
    {
        private TwitterClient twClient = new TwitterClient("twitter1", "yourNumericUserId");
        private FacebookClient fbClient = new FacebookClient("facebook1", "yourNumericUserId");

        public string Shout(string message)
        {
            string result;

            try {
                twClient.Post(String.Concat(message, "!!"));
                fbClient.Post(String.Concat(message, "!!"));

                result = "true";
            } catch(Exception) {
                result = "false";
            }

            return result;
        }
    }
}

Of course you have to provide your own user id, you can take your user id from the profile section, just click your name on the top right corner of Command Center and you should see your user information, your user id should be the first field.

Copy as paste this app in the Command Center application editor, save, compile and execute to test! you should be able to see the text provided as a parameter to the Shout method in your Twitter and Facebook timelines with the string “!!” as a suffix.

Happy iKnode coding!.