Plugin Development

This page is going through the basic steps to implement a plugin for the Notification Service.

Plugins should be thread-safe

Folder location

Plugins must be located in a sub-folder named Vtrin-NotificationServicePlugins[Version 5.3_25.04] (old name NotificationServicePlugins) in Vtrin folder. During installation, this folder should be automatically created and can be found in Vtrin folder.

Each plugin has its dedicated sub-folder with the same name. All dependency DLLs must be located here.

File naming

The main file of the plugin must be named with the prefix "NotificationServicePlugin_" for version 1 (e.g.: NotificationServicePlugin_Email.cs) or "NotificationServicePlugin2_" for version 2 (supported from 5.3_26.09).

Interfaces & parameters

Plugin 1

namespace ABB.Vtrin.NotificationService
{
  public interface INotificationServicePlugin
  {	
    void HandleMessage(string title, string content, string configurationstring);
  }
}

Plugin 2 (from 5.3_26.09)

namespace ABB.Vtrin.NotificationService
{ 
  public interface INotificationServicePlugin2
  {		
    void HandleMessage(System.Collections.Generic.IReadOnlyDictionary<string, object?>       parameters);
   }
}

Parameters sent from Notification Service via plugin 2 interface:

KeyValue
"title"Title for the message
"content"Content of the message
"configurationstring"

Example

namespace ABB.Vtrin.NotificationService
{
	public class ExamplePlugin : INotificationServicePlugin
	{	
		private string mConfiguration;		
		public ExamplePlugin(string configuration) 
		{
			mConfiguration = configuration;
		}

		public void HandleMessage(string title, string message, string configurationstring)
		{
			System.Console.WriteLine("Sending message to: " + configurationstring);
			System.Console.WriteLine("Title: " + title);
			System.Console.WriteLine("Message: " + message);
			System.Console.WriteLine("Configuration: " + mConfiguration);
		}
	}
}

For more comprehensive code example, please refer to Email and Azure WhatsApp plugins.


Did this page help you?