CM.Cdp.Events.Sdk 1.0.1.1

dotnet add package CM.Cdp.Events.Sdk --version 1.0.1.1                
NuGet\Install-Package CM.Cdp.Events.Sdk -Version 1.0.1.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CM.Cdp.Events.Sdk" Version="1.0.1.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CM.Cdp.Events.Sdk --version 1.0.1.1                
#r "nuget: CM.Cdp.Events.Sdk, 1.0.1.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install CM.Cdp.Events.Sdk as a Cake Addin
#addin nuget:?package=CM.Cdp.Events.Sdk&version=1.0.1.1

// Install CM.Cdp.Events.Sdk as a Cake Tool
#tool nuget:?package=CM.Cdp.Events.Sdk&version=1.0.1.1                

CDP EventsAPI SDK

.NET Standard SDK to send events with the CM CDP Events API

API Documentation

https://docs.cmtelecom.com/en/api/cdp-events/

Usage

Instantiate a client

HttpClient httpClient = new HttpClient();
CdpEventsClient eventsClient = new CdpEventsClient(httpClient, myApiKey);

httpClient is requested as a parameter, such that you can use a single instance throughout your application, as is highly recommended.

myApiKey is your unique api key (or product token) which authorizes you on the CM platform. Always keep this key secret!

baseUrl is optional and will be defaulted to https://api.cm.com when not filled in. Else the requests will be send to the filled in domain.

Send an event

You can send events by calling the AddEvents method and providing your tenantID (found in the settings page within your Cdp app), a list of events and a cancellation token (optional).

Each event should match a corresponding event type, in order for Cdp to correctly interpret your message. The event type Id's can be found in the sources page in your Cdp app.

ApiEvent[] events = new[]
{
	new ApiEvent
	{
		EventTypeId = registrationEventTypeId,
		Event = new Registration
		{
			Email = userEmailAddress,
			Message = "It's a great day",
			Subject = "The sun is shining and so are you."
		}
	},
	new ApiEvent
	{
		EventTypeId = crmUpdateEventTypeId,
		Event = new CrmUpdate
		{
			Email = userEmailAddress,
			PhoneNumber = userPhoneNumber
		}
	}
};
await eventsClient.AddEvents(myTenantId, events).ConfigureAwait(false);

Send an anonymous event

Some event types can be whitelisted, so that no authentication is needed for sending the events. This may be useful for sending tracking data from websites. When calling the AddAnonymousEvents method, your ApiKey will not be validated, only if the event type is whitelisted for your account.

ApiEvent[] events = new[]
{
	new ApiEvent
	{
		EventTypeId = memberPageVisitEventTypeId,
		Event = new PageVisit
		{
			Email = userEmailAddress,
			Page = currentPageUrl
		}
	}
};
await eventsClient.AddAnonymousEvents(myTenantId, events).ConfigureAwait(false);
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.1.1 1,229 6/16/2022
1.0.1 184 6/16/2022

First version with support for sending events and other available endspoints in CM's CDP