I’ve recently been working on Integrating Telligent Community with Sitecore using the ‘Telligent Community Sitecore SDK’ provided by Telligent. Before I started I managed to find one blog post on this on the whole of the internet…yep one.
So I thought I’d write up a few things I learned in case anyone else finds themselves needing to do this.
What is Telligent Community?
In case you don’t know, Telligent Community is an .NET based Community platform which support Forums, Blogs, Media Galleries, Wikis etc and allows you to build Communities of users with Profiles and Connections, Messaging, Activity Steams etc. Before I started working with Sitecore full-time I worked with the Telligent Platform (or Community Server as it was called in the early days) for over 5 years, so know I’d like to think I know it pretty well.
You can find out more about the integration options here: https://community.telligent.com/blog/b/product/posts/telligent-community-and-sitecore-integration
I notice there is also a new section on the Telligent Website that provides some info too: https://www.telligent.com/sitecore-forums-blogs-and-community/faq/
None of this really gives you much detail as to how to do this from a development perspective though so that is the focus of this post.
How does it work?
The Telligent Community Sitecore SDK is essentially an Framework that makes integrating with Telligent Community easier. You install it and initialise it by adding an Sitecore Pipeline implementation to your Sitecore project and patch in with config (as you would any custom Pipleline). You then get access to the Telligent REST APIs which allow you to pull your Telligent Community Content into Sitecore. You don’t get any of the Telligent Widgets embedded in Sitecore or anything – just access to the Data, but in a convenient way which handles the REST API authentication flow for you.
Rest Host
A Rest Host is the Primary interaction point with the SDK. It knows about your Community Url, handles authentication and caching and provides the Rest endpoint for making requests.
You can create your own rest hosts (as we will later) and there are two Rest Hosts provided out of the box:
1) Default REST Host – uses OAuth, is the most robust option
2) Client Credentials REST Host – uses Client Secret and Id, designed to be used for utility applications.
You can read more about Rest Hosts here: https://community.telligent.com/community/10/w/developer-training/53141/hosts
How do I get started?
You need to have an instance of Telligent Community up and running. You can download a free version (which has limitations) for testing from here: https://www.telligent.com/free-edition-download/. For the following example you will also need to create some test blog posts and create an API key for one of your users who has access to the Telligent APIs.
There are a few steps to getting up and running which we will cover in more detail in the example below:
1. Within your Sitecore project in visual Studio install the SDK using the following command:
Install-Package CommunityServerSDK
2. Create a Rest Host. We are creating a custom Rest Host in the following example – which uses API keys to authenticate users instead of OAuth or Client Secrets and Ids. It should be noted that this shouldn’t be used in production. It is provided as an example to get up and running quickly.
There is more on creating Rest Hosts here:
https://community.telligent.com/community/10/w/developer-training/59711/rest-sdk-and-sitecore
3. Create a Controller Rendering in Sitecore which uses the Host to get content from Telligent Community via the APIs
4. Add a view with Code to render out content from Telligent Community
Creating an Example Blog Post Component
1) Create an Rest Host:
2) Create an Blog Post Model:
3) Create a new Controller:
Edit the details of your community and blog id to match your setup.
4) Create an Controller Rendering in Sitecore and add a view with the following code:
Add the Component To a page in Sitecore and add a bit of styling and you should have something that looks like the following:
The code above is designed to get you up and running quickly so obviously isn’t production ready and things like your Community settings should be stored in config.
You will find the code for the SDK Samples on Github here:
https://github.com/Telligent/Social-SitecoreSDK-Samples
This is a pretty simple example but I intend to post some more complex integrations with Telligent Community and talk about how this was made more configurable from a Sitecore perspective in future posts.