Create a custom source definition
You can create a custom source definition and manage them using the List Manager. The association between a list and a source is created automatically when at least one contact is added to a list using that source.
To create a custom source definition:
-
On the Sitecore Launchpad, click Content Editor.
-
Go to /sitecore/System/Marketing Control Panel/Subscriptions.
-
In the tree view, right-click Subscriptions and click Insert from Template.
-
Expand the Templates/System/Analytics folder, click the Subscription item, and click Insert.
-
On the Content tab, in the Name field, type the name you want to appear on the contact list page.
-
To use the subscription across multiple contact lists, in the Tags field, define a shared value. Without a shared value, the life of the subscription source is tied to the contact list.
-
Deploy the created subscription definition item.
You can subscribe a contact to a list with a custom subscription source using the following API:
var contacts = new List<Contact>(); // List of contacts
var subscriptionService = ServiceLocator.ServiceProvider.GetService<ISubscriptionService>();
subscriptionService.Subscribe(contactListId, contacts, subscriptionSourceId);
Where subscriptionSourceId
is the ID of a subscription definition item.