This post continues my review of some of the new features of Kentico CMS 7. Up next on my list is the new Auto Publishing feature. This feature adds even more social media integration between Kentico CMS and Twitter / Facebook. The icing on the cake is that Auto Publishing comes right out of the box, no custom code is needed. Today I am not only going to review how to use the new Auto Publishing feature of Kentico, but also show you how to add it to any custom document type that you might have.
Let’s Get Started with Some Setup
Of course this type of integration requires you to know a little bit about the behind the scenes options for integrating with Twitter and Facebook. It’s really not that hard though, you just have to know where to go to get some of the information. If you want a quick primer I would encourage you to read these two articles, Getting Started with Twitter Platform and Facebook for Websites.
Alright let’s start, fire up your Kentico CMS 7 RC instance on your local machine, log in to the CMSSiteManager as an administrator, click Settings, and expand out Social Networks. If you don’t have Kentico CMS 7 RC running what are you waiting for ? Go download and install it from the office page. As you can see this setting section has been expanded in Kentico CMS 7. There are now sub sections for each major social network. This is the place to control the various integration options that Kentico CMS has with places like Facebook, Google+, LinkedIn, and Twitter.
Setting Up a New Twitter Application
The first setup type action we need to take is to create a way for Twitter to know how we are going to talk to it from our Kentico site. Once you are at the Social Network settings in CMSSiteManager click on Twitter. There you should see a screen just like the one below. It’s really just a bunch of settings and keys that you can store in Kentico to represent the Twitter Application that we are going to create.
Basically we just need to go get those settings from Twitter. To do that head on over to dev.twitter.com and sign in with your Twitter account. Once you are signed in, hover over your profile picture in the top right hand side of the screen. A small menu should drop down and you should be able to select My Applications. Click that and then click the Create a New Application button.
Now you should be at a screen that allows you to create a new application. Twitter considers any integration with it’s system an application, so the reason you need your own application is that you will need to generate the right tokens (settings) and set the permissions correctly for Kentico’s Auto Publish feature to talk to your Twitter feed. Go ahead and give your application a Name, Description, and Website URL (you can leave the callback URL empty). These settings will show up underneath any tweets that you publish from Kentico CMS. Agree to the terms and conditions and click Create your Twitter Application.
After you create your application you now now have access to the settings you need. Scroll down a bit to the OAuth settings section of the page. This is the first place you will see some of the key sets of information we are looking for.
You can now see the Consumer key and Consumer secret fields that Kentico needs. Copy those and paste them into the Twitter settings page back in CMSSiteManager. Those two settings correctly identify your application to Twitter. You also will need to give your new Twitter application permissions to write to your account’s feed. Scroll up to the top of the page and click the Settings tab.
Once the Settings tab has loaded scroll down to Application Type section and choose Read and Write. We aren’t really reading any information back to the CMS so there is no need for direct message access.
Scroll down some more and click the Update this Twitter Applications settings button to save the permission change. Now that we have given write permissions to your feed from your new app, we need to generate an Access Token. Click the Create My Access Token button to do so back on the details page of the app.
After you click the button you should see the rest of the settings you will need.
Grab the Access Token and Access Token Secret fields and paste them into the same settings as the first two. After you filled in all four settings click Save on the Kentico settings page. You should now be all set for Twitter. Remember though if you change permissions at any time you will need to regenerate a new Access Token.
Coming up Next
That’s all for Twitter, let’s move on to part 2 which will walk through setting up a new Facebook App and Facebook page for Kentico to automatically publish content to.