Another Dovetail CRM integration story…
This is part two of a two-part series on integrating Dovetail CRM with Telligent Enterprise. If you haven’t already, you might want to check out the first post in the series after you’re done reading this post.
In this post I will talk about the second integration scenario laid out in the previous post. I won’t get into all the nitty-gritty detail (line-by-line of code), but I’ll post a general step-by-step tour of integrating Telligent Enterprise with Dovetail CRM.
Let’s review the second scenario from my previous blog post:
When someone mentions a case in Telligent Enterprise, log an internal note to the case in Dovetail CRM so that agents can see when the case is being discussed by coworkers.
Tracking Mentions of a Case in the Case History
In this scenario, I want to keep Dovetail CRM in sync with discussions of and references to cases in conversations happening in my social collaboration system (Telligent Enterprise). As people in my company mention cases in a discussion, I want to log that to the case in Dovetail CRM.
There are several ways of accomplishing this with Telligent Enterprise. Some ways involve actively monitoring feeds coming out of Telligent Enterprise. Other ways involve “hooking” events inside of Telligent Enterprise and executing code in response to those events. There are advantages and disadvantages of each approach. For this blog post, I choose the later approach because I want real-time updating of Dovetail CRM when discussions mention cases.
In order to “hook” an event in Telligent, I need to implement a “CSModule.” CSModules are the recommended point of integration, customization, and extension of Telligent Enterprise. In fact, much of the functionality in Telligent Enterprise itself is implemented via CSModules.
Creating a New Visual Studio Project
To start creating a CSModule, I need to create a new solution in Visual Studio 2010 and add a new C# class library project. I called my solution “TelligentIntegration” and my class library project “DovetailCSModules.”
Next, use the “Add References” dialog in Visual Studio to add a reference to the “CommunityServer.Components” assembly. This is Telligent Enterprise’s integration API assembly. To work with Dovetail CRM’s API, I add a reference to the “DovetailCRM.Core” assembly that is included in the Dovetail CRM installation.
Finally, I add a new C# class called “DovetailAMModule.cs” (short for Dovetail Activity Message Module). This class will be a CSModule that will monitor for new “Activity Messages” (somewhat like “tweets” in Twitter).
Coding the CSModule
A CSModule has two parts: The Init method and Event Handler methods. A CSModule can hook multiple events in Telligent Enterprise, but I only need to hook one event: “PostMessageUpdate.” This event fires immediately after a user has posted a new Activity Message.
In my event handler, I scan the body of the recently-posted message for the pattern “Case #XXXX” This is so that if someone mentions “Case #1234,” I can detect that and log a note against Case #1234 in Dovetail CRM.
If I detect that a case is being mentioned, I use the Dovetail CRM API to connect to the Dovetail CRM database and attempt to load a Case object using that identifier. If that is successful, then I log the entire Activity Message body as an internal note against that Case.
This is a snippet of what my code looks like to find a Case from the database and log a note to it (but only if the Case is in currently “Open”):
var theCase = repository.FindBy<Case>(c => c.Identifier == identifier); if (theCase != null && theCase.IsOpen()) { var log = new NotesLog { Notes = message.Body, Internal = true }; logService.LogActivity(theCase, log); }
Deplying the CSModule
Once I’m satisfied with my code, I deploy it to my test Telligent server. To do this, I compile my Visual Studio solution and then copy the DovetailCSModules.dll file that was created (and all its dependencies) to the “bin” folder of the Telligent Enterprise installation folder (usually c:\inetpub\Telligent).
Next, I have to tell Telligent that there’s a new CSModule available for it to load, so I have to create a “communityserver_override.config” file in the root installation folder of Telligent. For more information on creating your communityserver_override.config file, consult Telligent’s documentation on the subject.
Next, I simply have to “touch” the web.config file (which is the simplest way to restart an ASP.NET-based application). This will force Telligent to reload its configuration and notice the CSModule I just added.
Verifying It Works
The final step is to just test my CSModule and make sure it works. I open Telligent Enterprise in a web browser and type in an activity message that references a case (for example, Case #1007).
Finally, I go back to Dovetail CRM and open Case 1007 and ensure that a note was logged to the case. And there it is! (Click the image for a larger view)
Summary
In this post, I illustrated how you could extend a third party application to integrate with Dovetail CRM. I also showed how easy it is to use Dovetail CRM’s API from other applications.
I hope that this post sparks some imagination and conversations about how we can create deep, rich integration stories between various platforms and Dovetail CRM.