The default property fields for receivers in Newsletter Studio are: name, e-mail, subscribed date and status. But some clients want to add custom data to their contacts.
Since version 2.1 we've decided to prepare the underlying data layer for this by adding a new property called “Data” on the Receiver-object. This means that we can pass key-value data from our subscription providers into the send out engine and use them in our render tasks.
At the moment the default mailing lists in Newsletter Studio don’t use this data-collection and there is no user interface to work with custom data but that is in the backlog of the project. The good news is that if you are sending to Umbraco members or using a custom data source – you can leverage this feature now. In the case of Umbraco members all custom property values will be added to the custom data collection.
For the feature to work, the first thing you'll have to do is to activate the it. Go to "General settings", check the "Activate custom data collection"-checkbox and save the settings.
Since we are in the process of streamlining this feature the UI support isn’t 100% so if you want to include content from the custom data-collection you’ll have to write the merge field placeholders manually.
Let’s say you have a custom property on your member type called “Age” with the alias of “age” to include this in your email just write something like:
Your age is: [#age]
And Newsletter Studio will replace this with the value from that unique member. So the basic idea is to use [#aliasOfProperty] to include the value in the message body.
If you are using a custom subscription provider you only need to add your custom data to the Data-property of the Receiver-objects that you return for the GetSubscribersForSendOut()-method. The built in subscription provider for Umbraco members fetches the data like this:
var receiver = new Receiver()
{
Fullname = member.Name,
Email = member.Email,
DataProviderKey = member.Id.ToString(),
};
if(useCustomData)
{
var data = new Dictionary();
data.Add("email", member.Email);
data.Add("username", member.Username);
data.Add("loginname", member.Username);
data.Add("login", member.Username);
data.Add("name", member.Name);
receiver.Data = data;
}
We will improve the editor experience for this in the future and we're also looking at how we can add custom data as settings for the built in mailing lists.
Using a render task an developer can hook into the rendering process of the email and make changes to the message body/subject. This can be done both on an overall level and on each individual email (ie. personalization). This feature could for example be used to replace [sometext] inside the messag…
Can be used to hook into other systems or data sources. Newsletter Studio will use the providers to fetch the needed information about the receivers. All current subscriptions options (Newsletter Studios native mailing list and Umbraco members) are build with providers and it's easy to implement you…
To interact with Newsletter Studio from the front end we provide a very simple API in the static class NewsletterStudio.Api. This class has several methods for adding and removing subscribers both from the built in subscriptions and from Umbraco's member section (it won't delete anything but it chan…
Since version 1.4.5 and 2.1 Newletter Studio contains some events that you as a developer can use when you develop your solutions. Event name v1.4.5+ v2.1+ NewsletterStudio.Services.SendNewsletterService.SendningInitializing Yes Yes NewsletterStudio.Services.SendNewsletterService.Sent Yes Ye…
There is a lot of things that can be done using the services and repositories that Newsletter Studio provides. You can explore these APIs using the "GlobalFactory" which is a service locator that the package uses internally. For example, you can access the Mailing List Repository like this: Newslett…