Skip to content

RedPointGlobal/RPI-Realtime-Plugin-Example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rp_cdp_logo

Redpoint Interaction (RPI) | Realtime Plugins

RPI Realtime consists of a suite of functionality that allows you to make decisions about the most appropriate content to be displayed to a person of interest in real time. Typically, RPI Realtime is used to make such decisions in the context of a web page (either an RPI landing page, or an externally-hosted web page), with the most appropriate content being rendered to a page visitor. However, its capabilities extend beyond this use case, with the RPI Realtime API (Application Programmer's Interface) facilitating leverage of its capabilities in a range of contexts e.g. Internet of Things (IoT) devices and inbound call centers.

Developers can enhance the functionality of RPI Realtime by creating plugins that extend the capabilities of the RPI Realtime API. There are a number of different types of plugins that can be created. These are detailed below.

Table of Contents

Getting Started

The Realtime-Example-Plugin C# project provides an example of building each type of plugin. Plugins should be built in a class library using .NET 9.

The plugin project will require the following Nuget package reference:

  • RedPoint.Web.Shared.

This can be found on our Nuget feed https://nuget.redpointcdp.com/packages/index.json.

All plugins except the Geolocation plugins require two classes:

  • Factory class: this initializes new plugins, setting any custom configuration settings.
  • Plugin class: this contains the code to execute the plugin logic.

Geolocation plugins only require a plugin class.

Once the plugin is compiled, the DLL can be mounted on the realtime containers. Any configuration settings are defined in values.yaml located in our RPI Helm Chart

Plugin Types

Decision plugins

These plugins can execute code at different points of the decision flow. They can influence the decision made, modify the result or add extra processing where required.

decision_flow

Pre-decision plugins

Pre-decision plugins execute prior to the decision being made. They can be used to modify the request, add additional data to the request, or perform any other processing that needs to occur before the decision is made.

Plugin Info
Endpoint /api/v2/smart-assets/results
Factory Base Class / Interface RedPoint.Resonance.Web.Shared.Plugins.FilterableRealtimePluginFactoryBase
Plugin Interface RedPoint.Resonance.Web.Shared.Plugins.IPredecisionPlugin
Inputs Decision Request Details, Visitor Profile
Outputs Visitor Profile
Configuration Type Predecision

Post-decision plugins

Post-decision plugins execute immediately after a decision is made. They can be used to update the result, or perform any other processing that needs to occur before the decision result is returned.

Plugin Info
Endpoint /api/v2/smart-assets/results
Factory Base Class / Interface RedPoint.Resonance.Web.Shared.Plugins.IRealtimePluginFactory
Plugin Interface RedPoint.Resonance.Web.Shared.Plugins.IDecisionContentPlugin
Inputs Decision Result, Visitor Profile
Outputs Decision Result
Configuration Type N/A

Smart Asset plugins

Smart Asset plugins execute once all the decision responses associated with a Smart Asset request have completed. They can be used to modify or process the full response instead of individual decisions.

Plugin Info
Endpoint /api/v2/smart-assets/results
Factory Base Class / Interface RedPoint.Resonance.Web.Shared.Plugins.FilterableRealtimePluginFactoryBase
Plugin Interface RedPoint.Resonance.Web.Shared.Plugins.ISmartAssetResultsPlugin
Inputs Request Details, Collection of Decision Results, Visitor Profile
Outputs Collection of Decision Results
Configuration Type SmartAssetResults

Event plugins

Event plugins can be used to modify or process any realtime event e.g. Page Visit.

Plugin Info
Endpoint /api/v2/events
Factory Base Class / Interface RedPoint.Resonance.Web.Shared.Plugins.FilterableRealtimePluginFactoryBase
Plugin Interface RedPoint.Resonance.Web.Shared.Plugins.IEventPlugin
Inputs Realtime Event
Outputs Realtime Event
Configuration Type Event

Form plugins

Form plugins can be used to modify or process any web form submission data passed to RPI Realtime for ingestion by RPI.

Plugin Info
Endpoint /api/v2/form-data
Factory Base Class / Interface RedPoint.Resonance.Web.Shared.Plugins.IFormProcessingPluginFactory
Plugin Interface RedPoint.Resonance.Web.Shared.Plugins.IFormProcessingPlugin
Inputs Form Data
Outputs Form Data
Configuration Type N/A

Visitor Profile plugins

Visitor Profile plugins can be used to modify or process the visitor profile when a profile is added or updated through a call to the Visitor Registration endpoint.

Plugin Info
Endpoint /api/v2/cache/visit
Factory Base Class / Interface RedPoint.Resonance.Web.Shared.Plugins.FilterableRealtimePluginFactoryBase
Plugin Interface RedPoint.Resonance.Web.Shared.Plugins.IVisitorCachePlugin
Inputs Visitor Profile, Registration Request Details
Outputs Visitor Profile
Configuration Type Visitor

Geolocation Decision plugins

Geolocation decision plugins can be used to integrate new geolocation service providers to RPI Realtime to enable Geolocation rules be used in realtime decisions.

Geolocation plugins

The gelocation plugin can be used to look up address information, weather observations, forecasts and geofence information. This can be done using either longitude and latitude coordinates or a search string.

Plugin Info
Endpoint /api/v2/smart-assets/results
Factory Base Class / Interface N/A
Plugin Interface IGeolocationProvider
Inputs Long/Lat or Search String
Outputs Address, Weather & Geofence Results
Configuration Type N/A

IP to Geolocation plugin

The IP to Geolocation plugin can be used to make use of long/lat lookup services using a supplied IP address. This enhances the number of opportunities for making geolocation based decisions.

Plugin Info
Endpoint /api/v2/smart-assets/results
Factory Base Class / Interface N/A
Plugin Interface IGeoIPLookupPlugin
Inputs IP Address
Outputs Long/Lat
Configuration Type N/A

Configuration

Plugin Path

After compiling the plugin, the resulting DLL must be made available to the RPI Realtime container. The Helm chart is configured to automatically mount the corresponding volume and set the location of the plugins, but you are responsible for provisioning the underlying storage based on your hosting platform’s procedure, and uploading the DLL to that location. For instance, in Azure, create an Azure file share, upload the DLL to the share. Once that is done, create a PersistentVolume (PV) and PersistentVolumeClaim (PVC) and reference its name in the RPI Helm chart values.yaml file as shown below:

storage:
  persistentVolumeClaims:
    Plugins:
      enabled: true
      claimName: realtimeplugins
      mountPath: /app/plugins

Application Settings

The plugins are configured using the values.yaml file located in our RPI Helm Chart. This is located under the realtimeapi section

realtimeapi:
  customPlugins:
    enabled: true
    settings.
        list:
        - name: my_plugin1
          factory:
            assembly: my_plugin1_assembly
            type: Plugin1_type
          type:
            name: my_plugin1_type_name
            apiContextFilters:
              - my_filter1
            apiContentFilterOperator: Include
          settings:
            - key: key1
              value: value1
            - key: key2
              value: value2
        - name: my_plugin2
          factory:
            assembly: my_plugin2_assembly
            type: Plugin2_type
          type:
            name: my_plugin2_type_name
            apiContextFilters:
              - my_filter1
            apiContentFilterOperator: Include
          settings:
            - key: key1
              value: value1
            - key: key2
              value: value2

Logging

Logging within plugins can be done using the TraceLogHelper class from the RedPoint.Resonance.Web.Shared.Logging namespace. This allows for sending trace information, warnings, and errors that can be categorized and filtered in the RPI Realtime logging system.

Example usage in a plugin:

TraceLogHelper.SendTraceInformation("This is an informational message", category: RealtimeLogCategory.Plugin);
TraceLogHelper.SendTraceError(new Exception("An error occurred"), "Error message", category: RealtimeLogCategory.Plugin);

The logging level for Plugin messages can be configured via the Helm Chart to help monitor and troubleshoot plugin behavior during runtime.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages