Integrating CRM systems with the 3CX CRM API on 3CX Phone System 10
The CRM plugin API is designed to allow customers and developers to easily integrate with CRM applications. Using this API you can do the following:
- Launch calls from your application
- Get notifications about the duration of a call
- Get notifications about inbound calls and pop up customer records based on Caller ID
Note: 3CX DOES NOT PROVIDE DEVELOPER SUPPORT for this API. If you feel that the documentation provided with the sample application can be improved, please login to the 3CX Support Portal, and submit a ticket with your comments. Please try to be as specific as possible with your description.
The API requires 3CX CRM integration module to be installed on the machine on which you wish to use the CRM API.
The difference between the CRM Command Line API and the CRM plugin API is that the plugin API allows you to add a module to the CRM integration software and re-use much of the functionality we have created for other CRM systems.
A sample plugin implementation is available from here.
Overview
3CX CRM integration module has been designed to be extended with pluggable modules. You can write your own CRM plugin easily using any .NET language, making integration between 3CX Phone System and your CRM a breeze.
The CRM Plugin Interface
In order to write your own plugin you need to create a .NET 2.0 library containing a public class that implements following interface:
As you can see, you just need to implement a few methods in order to get it working.
CRM Plugin Interface Details
The new CRM plugin class that you will create needs to have some methods, properties and events:
- The Start method is invoked by the application when the CRM plugin must start working. This may happen when it is enabled for the first time, or when the application starts with the plugin enabled.
- The Stop method is invoked by the application when the CRM plugin must stop working. This may happen when it is disabled, or when the application ends.
- The ReloadConfiguration method is invoked by the application after saving configuration changes. The plugin should read configuration settings again and adapt its behavior accordingly.
- You have guarantee that these three methods (Start, Stop and ReloadConfiguration) are invoked always from the same thread.
- The GetName method must return the plugin name. The returned value will be used everywhere the application needs to identify a plugin, for example in the “Plugin Configuration” tree view.
- The GetIcon method must return an icon for the plugin. It is used in the “Plugin Configuration” tree view.
- The GetConfigurationControl method must return an instance of a class derived from PluginConfigurationControl. This is the control shown to the user when he/she wants to configure the plugin. The PluginConfigurationControl class is derived from System.Windows.Forms.UserControl, adding the Save virtual method. You must override that method and implement the save setting logic there.
- The HasToStoreCallInformation property informs if the plugin has to store call information after an inbound or outbound call has finished. When true, the main application will invoke the StoreCallInformation method when a call ends.
- The GetContactInformation method is invoked when an inbound call arrives and the plugin is enabled. Note that multiple simultaneous call arrivals may trigger multiple calls to GetContactInformation from different threads.
- The ShowContactRecord method is invoked when the user clicks the “Click to open the contact record” link in the screen pop-up. Note that multiple clicks from the user in different screen pop-ups may trigger multiple calls to ShowContactRecord from different threads simultaneously.
- The CreateContactRecord method is invoked when the user clicks the “Click to create a new contact record” link in the screen pop-up. Note that multiple clicks from the user in different screen pop-ups may trigger multiple calls to CreateContactRecord from different threads simultaneously.
- The StoreCallInformation method is invoked when an inbound or outbound call ends and the property HasToStoreCallInformation is set to true, containing the information related to the call.
- The VerifyPluginState method is invoked regularly when the plugin is enabled in order to verify its state. If the plugin detects an error, it should throw an exception indicating the error.
- The GetAdditionalWorkingStatusInformation method is invoked regularly when the plugin is enabled and working (i.e. not having errors), in order to get a description to show in the plugin status page. If the plugin doesn’t need to show additional information in the status page, then just return an empty string.
In order to request an outbound call the plugin needs to trigger the event OnOutboundCallRequest, indicating the destination number. Note that a prefix may be added later by the main 3CX CRM Integration module, for example to select an outbound route.
Creating your Plugin with Microsoft Visual Studio
The procedure to create your plugin with Microsoft Visual Studio is very simple. You can use Visual Studio 2005, 2008 or 2010:
- Create a new project. Select the .NET language of your choice (C#, VB .NET, etc.) and create a new “Windows Class Library” project. Ensure that the project targets .NET Framework 2.0.
- Add a reference to the library “CRM Plugin Interface.dll” installed with the 3CX CRM Integration module (usually C:\Program Files\3CX CRM Integration\CRM Plugin Interface.dll).
- Rename the default class “Class1” to something valid for your plugin, for example “MyCrmPlugin”, and then change that class to implement TCX.CRM.IPlugin.
- Add the interface implementation:
- You will get something like this:
- Now you need to complete the implementation of each method, according to the description above.
Deploying your Plugin
When you have the .NET library ready, just drop it in the Plugins folder into the 3CX CRM Integration installation folder (usually C:\Program Files\3CX CRM Integration\Plugins) and restart the “3CX CRM Integration” application. The new CRM plugin library will be automatically loaded, and you will be able to configure it with the “3CX CRM Integration” application interface.



