<?xml version="1.0" encoding="utf-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><language>en</language><title>Blog posts by Philipp Gaska</title> <link>https://world.optimizely.com/blogs/philipp-gaska/</link><description></description><ttl>60</ttl><generator>Optimizely World</generator><item> <title>Sending automated order confirmations via Optimizely Campaign</title>            <link>https://world.optimizely.com/blogs/philipp-gaska/dates/2021/9/sending-automated-order-confirmations/</link>            <description>&lt;p&gt;In this blog post, I want to give you a basic example on how to automatically send an order confirmation via Optimizely Campaign. A transactional mail serves as template for the order confirmation which you can create either via the &lt;a href=&quot;https://webhelp.optimizely.com/latest/en/campaign/omnichannel/xmails.htm&quot;&gt;Optimizely Campaign user interface&lt;/a&gt; or the &lt;a href=&quot;/link/8693e50904d04f838570574aa64175e5.aspx&quot;&gt;REST API&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;&lt;a&gt;&lt;/a&gt;Processing order data&lt;/h2&gt;
&lt;p&gt;When a customer registers in your web shop and completes a purchase order, you collect the data (including information such as product item and price) and store it in JSON format: &lt;code&gt;{&quot;item&quot;:&quot;Boots&quot;,&quot;price&quot;:&quot;49.99&quot;}&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;You transmit this data together with other recipient data into a dedicated field of the transactional mail&#39;s recipient list. You can also store the whole HTML content and different language versions in the transaction recipient list to use only one transactional mail as template instead of creating multiple versions.&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;&lt;a&gt;&lt;/a&gt;Creating field functions&lt;/h2&gt;
&lt;p&gt;To access the individual variables within the JSON object and directly insert them into the mailing text, create a field function that refers to the dedicated recipient list field.&lt;/p&gt;
&lt;p&gt;&lt;a&gt;&lt;/a&gt;The following sample velocity field function replaces the whole mailing content of the transactional mail and refers to the &quot;order&quot; recipient list field which contains the order data:&lt;/p&gt;
&lt;pre class=&quot;language-xml&quot;&gt;&lt;code&gt;#set ($jsonContent = $json.readFromString($!{user.data.order}))
Dear customer,
&amp;lt;br/&amp;gt;
Thank you for your purchase! You successfully completed the order of &amp;lt;b&amp;gt;${jsonContent.item}&amp;lt;/b&amp;gt; and already paid the full amount of &amp;lt;b&amp;gt;${jsonContent.price} Euro&amp;lt;/b&amp;gt;. You will receive another confirmation email as soon as your order has been shipped.
&amp;lt;br/&amp;gt;
Best regards,
&amp;lt;br/&amp;gt;
Your web shop team
&amp;lt;br/&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;Converting prices&lt;/h3&gt;
&lt;p&gt;If you store prices in cent amounts and want to convert them to decimal amounts (e.g., 4999 cents to 49.99 euros), you can use the following function:&lt;/p&gt;
&lt;pre class=&quot;language-java&quot;&gt;&lt;code&gt;#macro(priceConverter $value)$!{null}#set($int=0)$!{null}#set($netto=$int.parseInt($value))$!{null}#set($netto=$StringHelper.percentage(10000, $netto, 2, $Common.locale(&quot;de&quot;, &quot;&quot;, &quot;&quot;)))$!{null}$netto$!{null}#end&lt;/code&gt;&lt;/pre&gt;
&lt;h3&gt;Displaying JSON objects as HTML text&lt;/h3&gt;
&lt;p&gt;If you have a JSON array with multiple items and prices, for example, &lt;code&gt;&quot;order&quot;:[{&quot;item&quot;:&quot;Boots&quot;,&quot;price&quot;:4999},{&quot;item&quot;:&quot;Books&quot;,&quot;price&quot;:1299}]&lt;/code&gt;, and want to display each of them as HTML text, you can use the following function:&lt;/p&gt;
&lt;pre class=&quot;language-java&quot;&gt;&lt;code&gt;#foreach($data in $jsonContent.order)
&amp;lt;h2&amp;gt;$data.item&amp;lt;/h2&amp;gt;&amp;lt;/br&amp;gt;
Price: #priceConverter($data.price) &amp;amp;Euro;&amp;lt;/br&amp;gt;&amp;lt;/br&amp;gt;
#end&lt;/code&gt;&lt;/pre&gt;
&lt;div class=&quot;greenBox&quot;&gt;&lt;strong&gt;Tip:&lt;/strong&gt; For more information about field functions, see the &lt;a href=&quot;https://webhelp.optimizely.com/latest/en/campaign/manage-content/field-functions.htm&quot;&gt;Optimizely User Guide&lt;/a&gt;.&lt;/div&gt;
&lt;h2&gt;Sending the order confirmation&lt;/h2&gt;
&lt;p&gt;To transmit the order data and send the order confirmation, use the &lt;a href=&quot;https://api.campaign.episerver.net/apidoc/index.html#/Transactional%20mails/sendTransactionalMailing&quot;&gt;POST​/{clientId}​/transactionalmail​/{transactionalMailId}​/send&lt;/a&gt; operation.&lt;/p&gt;
&lt;p&gt;You need the following information:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span&gt;&lt;strong&gt;Client ID&lt;/strong&gt;&lt;/span&gt;&lt;span&gt;. The ID of the client the REST API is &lt;/span&gt;&lt;a href=&quot;/link/37288475a0884c6d9fe56a4717991432.aspx#client&quot;&gt;set up&lt;/a&gt;&lt;span&gt; for. You can find the client ID in Optimizely Campaign under Administration &amp;gt; API Overview &amp;gt; REST API.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&lt;strong&gt;Transactional mail ID&lt;/strong&gt;&lt;/span&gt;&lt;span&gt;. The ID of the transactional mail that serves as template for the order confirmation. You can find the transactional mail ID in Optimizely Campaign under Campaigns &amp;gt; Transactional Mails.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&lt;strong&gt;Recipient list ID&lt;/strong&gt;&lt;/span&gt;&lt;span&gt;. The ID of the transaction recipient list. You can find the recipient list ID in Optimizely Campaign under Administration &amp;gt; API Overview &amp;gt; Recipient Lists.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;&lt;strong&gt;Recipient ID&lt;/strong&gt;&lt;/span&gt;&lt;span&gt;. The customer&amp;rsquo;s email address.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;&lt;strong&gt;Data&lt;/strong&gt;&lt;/span&gt;. The order data to be displayed in the order confirmation.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;nbsp;The request in curl looks as follows:&lt;/p&gt;
&lt;pre class=&quot;language-xml&quot;&gt;&lt;code&gt;curl -X POST &quot;https://api.campaign.episerver.net/rest/123456789/transactionalmail/987654321/send&quot; 
-H &quot;Authorization: BASIC k783r3fjn989dhnfjjdr83dgds1383NDfv=&quot; 
-d &quot;data.order=%7B%22item%22%3A%22Boots%22%2C%22price%22%3A%2249.99%22%7D&amp;amp;recipientListId=238312130812&amp;amp;recipientId=customer%40example.com&quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The transactional mail contains only the field function and looks as follows when the order confirmation is sent:&lt;/p&gt;
&lt;pre&gt;Dear customer,&lt;br /&gt;&lt;br /&gt;Thank you for your purchase! You successfully completed the order of &lt;strong&gt;Boots&lt;/strong&gt; and already paid the full amount of &lt;strong&gt;49.99 Euro&lt;/strong&gt;. You will receive another confirmation email as soon as your order has been shipped.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;&lt;br /&gt;Your web shop team&lt;/pre&gt;</description>            <guid>https://world.optimizely.com/blogs/philipp-gaska/dates/2021/9/sending-automated-order-confirmations/</guid>            <pubDate>Wed, 29 Sep 2021 11:17:15 GMT</pubDate>           <category>Blog post</category></item><item> <title>Working with the Optimizely Campaign webhooks</title>            <link>https://world.optimizely.com/blogs/philipp-gaska/dates/2021/8/working-with-the-optimizely-campaign-webhooks/</link>            <description>&lt;p&gt;&lt;span&gt;Using webhooks, you can get real-time event data on sent mailings, opens, clicks, bounces, and unsubscribes. For example, instead of retrieving the data on a regular basis by using the response data export job, our REST API based webhooks provide you with the data within seconds.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;You can immediately process the data and create, for example, in-app notifications or monitoring dashboards in third-party systems such as CRM software. So, you don&amp;acute;t have to open Optimizely Campaign to check which mailings were successfully delivered to the recipient.&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;div class=&quot;greenBox&quot;&gt;&lt;span&gt;&lt;strong&gt;Tip:&lt;/strong&gt; Regularly check&amp;nbsp;our&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;/link/bac2c19b2b2b4a6fb3eba23049cdc3d1.aspx&quot;&gt;&lt;span&gt;Release Notes&lt;/span&gt;&lt;/a&gt;&lt;span&gt;&amp;nbsp;for updates. We continuously improve and extend the webhook functionalities and will provide more event types in future.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;h2&gt;Early adopter: METRO.digital&lt;/h2&gt;
&lt;p&gt;&lt;span&gt;METRO.digital, the company behind the digital solutions for the METRO global wholesale business, is one of the first implementers of our webhooks.&amp;nbsp;METRO.digital&amp;nbsp;uses the API client Postman and&amp;nbsp;our&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://api.campaign.episerver.net/apidoc/index.html&quot;&gt;&lt;span&gt;Swagger documentation&lt;/span&gt;&lt;/a&gt;&lt;span&gt;&amp;nbsp;to test the webhooks and build new solutions for processing customer data:&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span&gt;&lt;strong&gt;Updating customer master data&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;Keeping the customer&#39;s subscription status up to date by using the bounce and unsubscribe events.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;&lt;strong&gt;Real-time monitoring and analyses&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;Analyzing the mailing dispatch (uptime/downtime, queueing/delays) based on the sent event to provide a backup plan in case of delayed transactional mails.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;&lt;strong&gt;Reporting and scoring&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;Enriching the data warehouse with internal campaign information and analyzing the customer&#39;s channel affinity, scoring and campaign performance for detailed campaign reports.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;&lt;span&gt;Creating a webhook for the bounce event&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span&gt;In the following example, I want to show you how to create a webhook for the bounce event using the&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;/link/37288475a0884c6d9fe56a4717991432.aspx&quot;&gt;&lt;span&gt;Optimizely Campaign REST API&lt;/span&gt;&lt;/a&gt;&lt;span&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;A bounce occurs when a message could not be delivered. There are two types of bounces:&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span&gt;&lt;strong&gt;Soft bounce&lt;/strong&gt;. Possible reason: The mailbox is&amp;nbsp;full,&amp;nbsp;but the recipient may receive mailings again later.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;&lt;strong&gt;Hard bounce&lt;/strong&gt;. Possible reason: The email address no longer exists.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;orangeBox&quot;&gt;&lt;span&gt;&lt;strong&gt;Note:&lt;/strong&gt; To enable the webhook feature, contact&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://webhelp.optimizely.com/latest/en/campaign/support/customer-support.htm&quot;&gt;&lt;span&gt;customer support&lt;/span&gt;&lt;/a&gt;&lt;span&gt;. See also:&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://webhelp.optimizely.com/latest/en/campaign/integration/webhooks.htm&quot;&gt;&lt;span&gt;Webhooks&lt;/span&gt;&lt;/a&gt;&lt;span&gt;&amp;nbsp;in the Optimizely user guide.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;p&gt;&lt;span&gt;To create the webhook, use the&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://api.campaign.episerver.net/apidoc/index.html#/Webhooks/createWebhook&quot;&gt;&lt;span&gt;POST/{clientId}/webhooks&lt;/span&gt;&lt;/a&gt;&lt;span&gt;&amp;nbsp;operation.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;span&gt;You&amp;nbsp;need the following information:&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span&gt;&lt;strong&gt;Client ID&lt;/strong&gt;&lt;/span&gt;&lt;span&gt;. The ID of the client the REST API is&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;/link/37288475a0884c6d9fe56a4717991432.aspx#client&quot;&gt;&lt;span&gt;set up&lt;/span&gt;&lt;/a&gt;&lt;span&gt; for. You can find the client ID in Optimizely Campaign under Administration &amp;gt; API Overview &amp;gt; REST API.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;&lt;strong&gt;Format&lt;/strong&gt;&lt;/span&gt;&lt;span&gt;. Data format in which the event data is to be sent. Currently available: JSON.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;&lt;strong&gt;Type&lt;/strong&gt;&lt;/span&gt;&lt;span&gt;. Event type &quot;bounce&quot;.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;&lt;strong&gt;Target URL&lt;/strong&gt;&lt;/span&gt;&lt;span&gt;. URL to which the event data is to be sent.&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;orangeBox&quot;&gt;&lt;strong&gt;Note:&lt;/strong&gt; Make sure that the URL is accessible and able to receive data via HTTP POST requests from the IP address 193.169.180.1 at any time. Use the latest HTTPS version and standard port 443 for HTTPS connections.&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span&gt;The request in curl looks as follows:&lt;/span&gt;&lt;/p&gt;
&lt;pre class=&quot;language-java&quot;&gt;&lt;code&gt;curl -X POST &quot;https://api.campaign.episerver.net/rest/123456789/webhooks&quot; 
-H &quot;Authorization: BASIC k783r3fjn989dhnfjjdr83dgds1383NDfv=&quot;
-d &quot;format=json&amp;amp;type=bounce&amp;amp;targetUrl=https%3A%2F%2Fwww.example.com&quot;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;span&gt;After creating the webhook, you can verify the webhook whether it is ready to use and can send event data to the specified target URL by using the&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://api.campaign.episerver.net/apidoc/index.html#/Webhooks/verifyWebhook&quot;&gt;&lt;span&gt;GET/{clientId}/webhooks/{webhookId}/verify&lt;/span&gt;&lt;/a&gt;&lt;span&gt;&amp;nbsp;operation.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;h2&gt;&lt;span&gt;Activating the webhook und retrieving real-time event data&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;&lt;span&gt;To activate the created webhook, use the&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://api.campaign.episerver.net/apidoc/index.html#/Webhooks/activateWebhook&quot;&gt;&lt;span&gt;POST/{clientId}/webhooks/{webhookId}/activate&lt;/span&gt;&lt;/a&gt;&lt;span&gt;&amp;nbsp;operation.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Specify the client ID and the webhook ID which you get as response when creating the webhook.&amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;div class=&quot;greenBox&quot;&gt;&lt;span&gt;&lt;strong&gt;Tip:&lt;/strong&gt; You can also use the&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://api.campaign.episerver.net/apidoc/index.html#/Webhooks/selectWebhooks&quot;&gt;&lt;span&gt;GET/{clientId}/webhooks&lt;/span&gt;&lt;/a&gt;&lt;span&gt;&amp;nbsp;operation to retrieve the IDs of all created webhooks.&lt;/span&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;p&gt;&lt;span&gt;The request in curl looks as follows:&lt;/span&gt;&lt;/p&gt;
&lt;pre class=&quot;language-java&quot;&gt;&lt;code&gt;curl -X POST &quot;https://api.campaign.episerver.net/rest/123456789/webhooks/987654321/activate&quot; 
-H &quot;Authorization: BASIC k783r3fjn989dhnfjjdr83dgds1383NDfv=&quot;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;span&gt;After activating, the event data is sent to the specified target URL whenever a bounce occurs. The payload consists of the following data, among other:&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span&gt;Bounce category - &quot;softbounce&quot; or &quot;hardbounce&quot;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Bounce reason - &quot;spam-related&quot; or &quot;other&quot;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Media type of the bounced message, e.g., &quot;EMAIL&quot;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Mailing ID&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;Recipient ID&amp;nbsp;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span&gt;Sample payload in JSON format:&lt;/span&gt;&lt;/p&gt;
&lt;pre class=&quot;language-json&quot;&gt;&lt;code&gt;{ 
    &quot;type&quot;:&quot;bounce&quot;, 
    &quot;id&quot;:&quot;0a673102-178d27b2c8c-178d2cac0e4-c7420699923845e&quot;, 
    &quot;recipientId&quot;:&quot;john.smith@example.com&quot;, 
    &quot;userListId&quot;:10180860004, 
    &quot;clientId&quot;:10180860001, 
    &quot;created&quot;:1617108575391, 
    &quot;subscriptionId&quot;:10227900201, 
    &quot;mailId&quot;:&quot;4P6W8B4-4P6W0LI-BSLXEC&quot;, 
    &quot;mailingId&quot;:10230355206, 
    &quot;mediaTypesToAddresses&quot;: { 
      &quot;EMAIL&quot;:&quot;john.smith@example.com&quot; 
    }, 
    &quot;category&quot;:&quot;softbounce&quot;, 
    &quot;mediaType&quot;:&quot;EMAIL&quot;, 
    &quot;reason&quot;:&quot;other&quot;, 
    &quot;thresholdExceeded&quot;:false 
}&lt;/code&gt;&lt;/pre&gt;
&lt;div class=&quot;greenBox&quot;&gt;&lt;span&gt;&lt;strong&gt;Tip:&lt;/strong&gt; To update the webhook without deactivating it or creating a new one, for example, to change the&amp;nbsp;target URL, you can use the&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://api.campaign.episerver.net/apidoc/index.html#/Webhooks/updateWebhook&quot;&gt;&lt;span&gt;PUT/{clientId}/webhooks/{webhookId}&lt;/span&gt;&lt;/a&gt;&lt;span&gt;&amp;nbsp;operation.&lt;/span&gt;&lt;/div&gt;</description>            <guid>https://world.optimizely.com/blogs/philipp-gaska/dates/2021/8/working-with-the-optimizely-campaign-webhooks/</guid>            <pubDate>Mon, 23 Aug 2021 11:00:50 GMT</pubDate>           <category>Blog post</category></item><item> <title>Right to be forgotten: Deleting recipient data</title>            <link>https://world.optimizely.com/blogs/philipp-gaska/dates/2021/7/right-to-be-forgotten-deleting-recipient-data/</link>            <description>&lt;p&gt;Data security and protecting the privacy of your customers and newsletter recipients is vital important. With the introduction of the General Data Protection Regulation (GDPR) at the latest, you must provide the possibility of deleting personal data upon request. This is embodied in Article 17 of the GDPR &amp;ndash; the so-called &quot;Right to be forgotten&quot;.&lt;/p&gt;
&lt;p&gt;To irrevocably delete all recipient data from Episerver Campaign (except blocklist entries which is anonymized data), you can use the &lt;a href=&quot;https://webhelp.episerver.com/latest/en/campaign/recipients/recipient-history.htm#Righttobeforgotten&quot;&gt;recipient history&lt;/a&gt; in the Episerver Campaign user interface.&lt;/p&gt;
&lt;p&gt;A more flexible way is using the &lt;a href=&quot;/link/37288475a0884c6d9fe56a4717991432.aspx&quot;&gt;Episerver Campaign REST API&lt;/a&gt;. This lets you delete recipient data remotely &amp;ndash; without logging in to Episerver Campaign. You can, for example, use the &lt;a href=&quot;https://api.campaign.episerver.net/apidoc/index.html&quot;&gt;Swagger Try it out&lt;/a&gt; feature, enter the &lt;a href=&quot;#curl&quot;&gt;curl request&lt;/a&gt; in the Windows command prompt, or implement a deletion option right into your system, such as a CRM software.&lt;/p&gt;
&lt;p&gt;To delete recipient data via REST API, use the &lt;a href=&quot;https://api.campaign.episerver.net/apidoc/index.html#/Recipients/wipeRecipientHistory&quot;&gt;DELETE /{clientId}​/recipients&lt;/a&gt; operation.&lt;/p&gt;
&lt;p&gt;You need the following information:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Client ID&lt;/strong&gt;. The ID of the client the REST API is &lt;a href=&quot;/link/37288475a0884c6d9fe56a4717991432.aspx#client&quot;&gt;set up&lt;/a&gt; for. You can find the client ID in Episerver Campaign under Administration &amp;gt; API Overview &amp;gt; REST API.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Reason&lt;/strong&gt;. Reason for data deletion.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Recipient key&lt;/strong&gt;. Recipient ID, usually the email address.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a id=&quot;curl&quot;&gt;&lt;/a&gt;The request in curl looks as follows:&lt;/p&gt;
&lt;pre class=&quot;language-java&quot;&gt;&lt;code&gt;curl -X DELETE &quot;https://api.campaign.episerver.net/rest/123456789/recipients?reason=customerrequest&amp;amp;recipientKey=recipient%40example.com&quot; -H &quot;Authorization: BASIC k783r3fjn989dhnfjjdr83dgds1383NDfv=&quot;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The following example shows the request as PHP code.&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&quot;orangeBox&quot;&gt;&lt;strong&gt;Note:&lt;/strong&gt; The PHP code is a basic example and is not ready to use in your live system. Use it only as a template for testing and adapt the code to your company&#39;s internal requirements.&lt;/div&gt;
&lt;pre class=&quot;language-javascript&quot;&gt;&lt;code&gt;&amp;lt;?php
$user = &#39;user@example.com&#39;; // API user name, usually your email address 
$password = &#39;password&#39;; // password of your API user
$clientId = 123456789; // ID of the client the REST API is set up for
$recipientId = &#39;recipient@example.com&#39;; // ID of the recipient whose data is to be deleted
$reason = &#39;customerrequest&#39;; // reason for data deletion (without blanks)
$URL = &#39;https://api.campaign.episerver.net/rest/&#39;.$clientId.&#39;/recipients?recipientKey=&#39;.$recipientId.&#39;&amp;amp;reason=&#39;.$reason;

$curl = curl_init();
curl_setopt($curl, CURLOPT_URL,$URL);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, &quot;DELETE&quot;);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //timeout after 30 seconds
curl_setopt($curl, CURLOPT_RETURNTRANSFER,1);
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, &quot;$user:$password&quot;);

$result = curl_exec ($curl);
$result = json_decode($result, true);
     
echo &#39;&amp;lt;pre&amp;gt;&#39;;
var_dump ($result);
echo &#39;&amp;lt;/pre&amp;gt;&amp;lt;br&amp;gt;&#39;;

curl_close ($curl);       

?&amp;gt;​&lt;/code&gt;&lt;/pre&gt;
&lt;div class=&quot;greenBox&quot;&gt;&lt;strong&gt;Tip:&lt;/strong&gt; To delete the recipient&#39;s blocklist entry, you can use the &lt;a href=&quot;https://api.campaign.episerver.net/apidoc/index.html#/Blacklist%20entries/deleteBlacklistEntry&quot;&gt;DELETE​/{clientId}​/blacklistentries​/{entry}&lt;/a&gt; operation.&lt;/div&gt;</description>            <guid>https://world.optimizely.com/blogs/philipp-gaska/dates/2021/7/right-to-be-forgotten-deleting-recipient-data/</guid>            <pubDate>Thu, 08 Jul 2021 09:18:42 GMT</pubDate>           <category>Blog post</category></item><item> <title>Updating mailing content via REST API</title>            <link>https://world.optimizely.com/blogs/philipp-gaska/dates/2021/6/updating-mailing-content-via-rest-api/</link>            <description>&lt;p&gt;In a &lt;a href=&quot;/link/63ddcd7eb3874618aea5c171c9c2b957.aspx&quot;&gt;previous blog post&lt;/a&gt;, I gave an example on how to use the Episerver Campaign REST API to create a Smart Campaign and mailing. To update the created mailing with plain text, you can use the &lt;a href=&quot;https://api.campaign.episerver.net/apidoc/index.html#/Smart%20Campaigns/updateCampaignMessage_1&quot;&gt;POST/{clientId}/smartcampaigns/{campaignId}/messages/{mailingId}&lt;/a&gt; operation.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I recommend using a more convenient operation for updating mailing content. The &lt;a href=&quot;https://api.campaign.episerver.net/apidoc/index.html#/Smart%20Campaigns/storeCampaignMessageContent_1&quot;&gt;POST​/{clientId}​/smartcampaigns​/{campaignId}​/messages​/{mailingId}​/content&lt;/a&gt; operation lets you update the mailing with plain text, HTML content, or multipart content that consists of HTML and plain text.&lt;/p&gt;
&lt;div class=&quot;orangeBox&quot;&gt;&lt;strong&gt;Note:&lt;/strong&gt; You can only update mailings created via REST API.&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;p&gt;You need the following information:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Client ID&lt;/strong&gt;. The ID of the client the REST API is &lt;a href=&quot;/link/37288475a0884c6d9fe56a4717991432.aspx#client&quot;&gt;set up&lt;/a&gt; for. You can find the client ID in Episerver Campaign under Administration &amp;gt; API overview &amp;gt; REST API.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Campaign ID&lt;/strong&gt;. ID of the created Smart Campaign. To get the campaign ID, you can use the &lt;a href=&quot;https://api.campaign.episerver.net/apidoc/index.html#/Smart%20Campaigns/selectSmartCampaigns&quot;&gt;GET​/{clientId}​/smartcampaigns&lt;/a&gt; operation. You can also find the campaign ID in Episerver Campaign under Campaigns &amp;gt; Smart Campaigns.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Mailing ID&lt;/strong&gt;. ID of the mailing whose content you want to update. To get the mailing ID, you can use the &lt;a href=&quot;https://api.campaign.episerver.net/apidoc/index.html#/Smart%20Campaigns/selectSmartCampaigns&quot;&gt;GET​/{clientId}​/smartcampaigns&lt;/a&gt; operation. You can also find the mailing ID in Episerver Campaign under Campaigns &amp;gt; Smart Campaigns.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;&lt;a&gt;&lt;/a&gt;Plain text&lt;/h2&gt;
&lt;p&gt;To transmit plain text, set the content type to &quot;text/plain&quot; in the request header and transmit the content within the request body. The request in curl looks as follows:&lt;/p&gt;
&lt;pre class=&quot;language-java&quot;&gt;&lt;code&gt;curl -X POST &quot;https://api.campaign.episerver.net/rest/123456789/smartcampaigns/987654321/messages/123454321/content&quot; -H &quot;Authorization: BASIC k783r3fjn989dhnfjjdr83dgds1383NDfv=&quot; -H &quot;Content-Type: text/plain&quot; -d &quot;This is plain text.&quot;&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;&lt;a&gt;&lt;/a&gt;HTML content&lt;/h2&gt;
&lt;p&gt;To transmit HTML content, set the content type to &quot;text/html&quot; in the request header and transmit the content within the request body. The request in curl looks as follows:&amp;nbsp;&lt;/p&gt;
&lt;pre class=&quot;language-java&quot;&gt;&lt;code&gt;curl -X POST &quot;https://api.campaign.episerver.net/rest/123456789/smartcampaigns/987654321/messages/123454321/content&quot; -H &quot;Authorization: BASIC k783r3fjn989dhnfjjdr83dgds1383NDfv=&quot; -H &quot;Content-Type: text/html&quot; -d &quot;This is &amp;lt;b&amp;gt;HTML&amp;lt;/b&amp;gt; content.&quot;&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;&lt;a&gt;&lt;/a&gt;Multipart content&lt;/h2&gt;
&lt;p&gt;Multipart content consists of plain text and HTML text. This is useful if, for example, a web browser is unable to display the HTML content correctly. Instead of displaying the text along with HTML tags, the plain text is displayed.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;To transmit multipart content, transmit the different content parts within the request body as form data without specifying the content type in the request header. The request in curl looks as follows:&amp;nbsp;&lt;/p&gt;
&lt;pre class=&quot;language-java&quot;&gt;&lt;code&gt;curl -X POST &quot;https://api.campaign.episerver.net/rest/123456789/smartcampaigns/987654321/messages/123454321/content&quot; -H &quot;Authorization: BASIC k783r3fjn989dhnfjjdr83dgds1383NDfv=&quot; -F &quot;content1=This is plain text.;type=text/plain&quot; -F &quot;content2=This is &amp;lt;b&amp;gt;HTML&amp;lt;/b&amp;gt; content.;type=text/html&quot;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;By default, the ISO-8859-1 charset is used. This charset represents only a limited number of languages. You can also specify a different charset within the request, for example, UTF-8:&lt;/p&gt;
&lt;pre class=&quot;language-java&quot;&gt;&lt;code&gt;curl -X POST &quot;https://api.campaign.episerver.net/rest/123456789/smartcampaigns/987654321/messages/123454321/content&quot; -H &quot;Authorization: BASIC k783r3fjn989dhnfjjdr83dgds1383NDfv=&quot; -H &quot;charset=utf-8&quot; -F &quot;content1=This is plain text.;type=text/plain&quot; -F &quot;content2=This is &amp;lt;b&amp;gt;HTML&amp;lt;/b&amp;gt; content.;type=text/html;charset=utf-8&quot;&lt;/code&gt;&lt;/pre&gt;</description>            <guid>https://world.optimizely.com/blogs/philipp-gaska/dates/2021/6/updating-mailing-content-via-rest-api/</guid>            <pubDate>Mon, 21 Jun 2021 09:19:24 GMT</pubDate>           <category>Blog post</category></item><item> <title>Working with newsletter unsubscribes</title>            <link>https://world.optimizely.com/blogs/philipp-gaska/dates/2021/2/working-with-newsletter-unsubscribes/</link>            <description>&lt;p&gt;In the blog post &lt;a href=&quot;/link/da5a040e7b404c05a85f44a23ac60968.aspx&quot;&gt;Setting up a newsletter subscription via REST API&lt;/a&gt;, I described how to use a double opt-in process to acquire new recipients in a legally secure way. Even if you do not want to lose the recipients you have acquired, it is essential to include an unsubscribe option in the newsletter and on your website. This is a basic requirement for serious email marketing because you should send your information only to those who are interested in it.&lt;/p&gt;
&lt;h2&gt;Including an unsubscribe link in your newsletter&lt;/h2&gt;
&lt;p&gt;In Episerver Campaign, you can easily implement the newsletter unsubscription via an &lt;a href=&quot;https://webhelp.episerver.com/latest/en/campaign/recipients/unsubscribers.htm#Insertinganunsubscribelinkintoamailing&quot;&gt;unsubscribe link&lt;/a&gt;. Add the &lt;em&gt;{Unsubscribe Link}&lt;/em&gt; field function in the newsletter footer after the greeting and contact information.&lt;/p&gt;
&lt;p&gt;When the recipients click on the link, they are added to Episerver Campaign&#39;s system-internal unsubscribe list. The recipients are not removed from the recipient list but are matched against the unsubscribe list in the future and skipped when the newsletter is sent.&lt;/p&gt;
&lt;p&gt;Also, the unsubscribe link redirects to a default confirmation page. If you want to use your own confirmation page, you can &lt;a href=&quot;https://webhelp.episerver.com/latest/en/campaign/recipients/unsubscribers.htm#ChangingtheconfirmationpageURL&quot;&gt;change it in Episerver Campaign&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/link/23cc2bd09c3e455b8b631d51dbe2cf81.aspx?1614089009223&quot; width=&quot;775&quot; alt=&quot;Image:&amp;#32;Changing&amp;#32;the&amp;#32;confirmation&amp;#32;page&amp;#32;URL&amp;#32;in&amp;#32;Episerver&amp;#32;Campaign&quot; height=&quot;212&quot; /&gt;&lt;/p&gt;
&lt;h2&gt;Setting up an unsubscribe form on your website&lt;/h2&gt;
&lt;p&gt;In addition to the unsubscribe link in the newsletter, you should also provide an unsubscribe form on your website. Like the newsletter subscription, you can do this by using the &lt;a href=&quot;/link/8693e50904d04f838570574aa64175e5.aspx&quot;&gt;Episerver Campaign REST API&lt;/a&gt;. Create a form and set up the API request using the &lt;a href=&quot;https://api.campaign.episerver.net/apidoc/index.html#/Unsubscribes/createUnsubscribes&quot;&gt;POST/{clientId}/unsubscribes&lt;/a&gt; operation.&amp;nbsp;&lt;/p&gt;
&lt;div class=&quot;orangeBox&quot;&gt;&lt;strong&gt;Note:&lt;/strong&gt; Set up the REST API in your client first, see &lt;a href=&quot;/link/37288475a0884c6d9fe56a4717991432.aspx#client&quot;&gt;Client setup&lt;/a&gt;.&lt;/div&gt;
&lt;p&gt;One advantage of an unsubscribe form is that you can ask for the unsubscribe reason and offer an opt-down. Since you do not want to lose your newsletter recipients completely, you can offer to receive an alternative newsletter with a lower sending frequency - for example, monthly instead of weekly. This way you create an unsubscribe form including a new subscription option and keep your unsubscribe rates low.&lt;/p&gt;
&lt;p&gt;For further information and tips on how to create subscription and unsubscribe forms, see the &lt;a href=&quot;https://webhelp.episerver.com/latest/en/campaign/recipients/opt-in/subscribe-unsubscribe.htm&quot;&gt;Episerver User Guide&lt;/a&gt;.&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;Managing unsubscribes&lt;/h2&gt;
&lt;p&gt;Monitor your newsletter unsubscribes and make sure that the unsubscribe process is working properly.&amp;nbsp;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Are all newsletter unsubscribes processed by the unsubscribe link in your database as scheduled?&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Do you also fulfill individual unsubscribe requests that reach you through reply emails?&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Therefore, regularly check the correct handling of your unsubscribe processes to avoid legal or provider-related problems. To monitor and manage unsubscribes, you can use the Episerver Campaign REST API.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In order to view the system-internal unsubscribe list, use the &lt;a href=&quot;https://api.campaign.episerver.net/apidoc/index.html#/Unsubscribes/selectUnsubscribes&quot;&gt;GET/{clientId}/unsubscribes&lt;/a&gt; operation. The request in curl looks as follows:&lt;/p&gt;
&lt;pre class=&quot;language-java&quot;&gt;&lt;code&gt;curl -X GET &quot;https://api.campaign.episerver.net/rest/123456789/unsubscribes?sort=created&quot; -H &quot;Authorization: BASIC k783r3fjn989dhnfjjdr83dgds1383NDfv=&quot;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &lt;em&gt;Unsubscribes&lt;/em&gt; REST API resource provides even more operations for managing unsubscribes:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/link/890a3249f2f04b1ea140b5b713bfae3e.aspx?1614085978113&quot; width=&quot;1450&quot; alt=&quot;Image:&amp;#32;Unsubscribes&amp;#32;REST&amp;#32;API&amp;#32;resource&quot; height=&quot;292&quot; /&gt;&lt;/p&gt;</description>            <guid>https://world.optimizely.com/blogs/philipp-gaska/dates/2021/2/working-with-newsletter-unsubscribes/</guid>            <pubDate>Tue, 23 Feb 2021 14:11:37 GMT</pubDate>           <category>Blog post</category></item><item> <title>Creating a Smart Campaign and mailing via REST API</title>            <link>https://world.optimizely.com/blogs/philipp-gaska/dates/2021/1/creating-a-smart-campaign-and-mailing-via-rest-api/</link>            <description>&lt;p&gt;Instead of using the front end, you can use the features and functionalities in Episerver Campaign remotely via &lt;a href=&quot;/link/37288475a0884c6d9fe56a4717991432.aspx&quot; title=&quot;REST API documentation&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;REST API&lt;/a&gt;. For example, you can create a Smart Campaign including its mailings. In this blog post, I like to show you a basic example on how to do so.&lt;/p&gt;
&lt;p&gt;To create and send a mailing campaign in Smart Campaigns (Episerver Campaign&#39;s &lt;span&gt;marketing tool for sending out one-shot-campaigns)&lt;/span&gt;, perform the following steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;#create&quot;&gt;Create a Smart Campaign&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#nodes&quot;&gt;Create a mailing and connect the nodes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#start&quot;&gt;Start the campaign&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;&lt;a id=&quot;create&quot;&gt;&lt;/a&gt;Creating a Smart Campaign&lt;/h2&gt;
&lt;p&gt;To create a Smart Campaign, use the &lt;a href=&quot;https://api.campaign.episerver.net/apidoc/index.html#/Smart%20Campaigns/createOrCopySmartCampaign&quot; title=&quot;Episerver Campaign REST API&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;POST/{clientId}/smartcampaigns&lt;/a&gt; operation. You need the following information:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Client ID&lt;/strong&gt;. The ID of the client the REST API is &lt;a href=&quot;/link/37288475a0884c6d9fe56a4717991432.aspx#client&quot; target=&quot;_blank&quot; title=&quot;REST API documentation&quot; rel=&quot;noopener&quot;&gt;set up&lt;/a&gt; for. You can find the client ID in Episerver Campaign under Administration &amp;gt; API overview &amp;gt; REST API.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Recipient list ID&lt;/strong&gt;. The ID of the recipient list you want to use for your campaign. Use the &lt;a href=&quot;https://api.campaign.episerver.net/apidoc/index.html#/Recipient%20lists/selectRecipientLists&quot; title=&quot;Episerver Campaign REST API&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;GET​/{clientId}​/recipientlists&lt;/a&gt; operation to retrieve all recipient list IDs of your client. You can also find the recipient list IDs in the Episerver Campaign start menu under Administration &amp;gt; API overview &amp;gt; Recipient lists.
&lt;div class=&quot;greenBox&quot;&gt;&lt;strong&gt;Tip:&lt;/strong&gt; Use a test recipient list to send a test mailing before the actual dispatch. You can also use the &lt;a href=&quot;https://api.campaign.episerver.net/apidoc/index.html#/Smart%20Campaigns/startTestMailing_2&quot; title=&quot;Episerver Campaign REST API&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;POST/{clientId}​/smartcampaigns​/{campaignId}​/messages​/{mailingId}​/test&lt;/a&gt; operation after you have created the mailing and connected the nodes.&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Name&lt;/strong&gt;. Specify a name for the campaign, such as &lt;em&gt;Test campaign&lt;/em&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The request in curl looks as follows:&lt;/p&gt;
&lt;pre class=&quot;language-java&quot;&gt;&lt;code&gt;curl -X POST &quot;https://api.campaign.episerver.net/rest/123456789/smartcampaigns&quot; -H &quot;Authorization: BASIC k783r3fjn989dhnfjjdr83dgds1383NDfv=&quot; -d &quot;recipientListIds=9876543210&quot; -d &quot;name=Test%20campaign&quot;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In the response body of the request, you can find information about the created campaign, such as campaign ID, name, status, and creation date.&lt;/p&gt;
&lt;h2&gt;&lt;a id=&quot;nodes&quot;&gt;&lt;/a&gt;Creating a mailing and connecting the nodes&lt;/h2&gt;
&lt;p&gt;The created campaign is incomplete and requires further editing. Use the &lt;a href=&quot;https://api.campaign.episerver.net/apidoc/index.html#/Smart%20Campaigns/createCampaignMessage&quot; title=&quot;Episerver Campaign REST API&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;POST/{clientId}/smartcampaigns/{campaignId}/messages&lt;/a&gt; operation to create a new message node with the actual mailing and connect it with the recipients node that contains the recipient list.&lt;/p&gt;
&lt;p&gt;You need the following information:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Client ID&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Campaign ID&lt;/strong&gt;. ID of the created Smart Campaign. To get the campaign ID, you can use the &lt;a href=&quot;https://api.campaign.episerver.net/apidoc/index.html#/Smart%20Campaigns/selectSmartCampaigns&quot; title=&quot;Episerver Campaign REST API&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;GET​/{clientId}​/smartcampaigns&lt;/a&gt; operation or go to the Episerver Campaign start menu &amp;gt; Campaigns &amp;gt; Smart Campaigns.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Media type&lt;/strong&gt;. Media type of the mailing, for example &lt;em&gt;email&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Sender address&lt;/strong&gt;. Email address of the mailing sender.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Predecessor node ID&lt;/strong&gt;. The ID of the recipients node. To retrieve the node ID, you can use the &lt;a href=&quot;https://api.campaign.episerver.net/apidoc/index.html#/Smart%20Campaigns/getSmartCampaign&quot; title=&quot;Episerver Campaign REST API&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;GET​/{clientId}​/smartcampaigns​/{campaignId}&lt;/a&gt; operation.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You also need to specify further parameters, such as mailing name, mailing subject, media type, and set the &quot;resetReplyToAddress&quot; parameter to &quot;true&quot;. When creating the mailing, you can only add plain text as mailing content. I will show you how to update the mailing with HTML or multipart content in a later blog post.&lt;/p&gt;
&lt;p&gt;The request in curl looks as follows:&lt;/p&gt;
&lt;pre class=&quot;language-java&quot;&gt;&lt;code&gt;curl -X POST &quot;https://api.campaign.episerver.net/rest/123456789/smartcampaigns/12345654321/messages&quot; -H &quot;Authorization: BASIC k783r3fjn989dhnfjjdr83dgds1383NDfv=&quot; -d &quot;senderName=John%20Smith&quot; -d &quot;predecessorNodeId=2&quot; -d &quot;name=Test%20mail&quot; -d &quot;subject=Test%20newsletter&quot; -d &quot;replyToName=John%20Smith&quot; -d &quot;content=This%20is%20the%20mailing%20content.&quot; -d &quot;resetReplyToAddress=true&quot; -d &quot;mediaType=email&quot; -d &quot;senderAddress=user%40example.com&quot;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You cannot divide the mailing content into individual content paragraphs via REST API. To do so, create the mailing in the Episerver Campaign front end by using the &lt;a href=&quot;https://webhelp.episerver.com/latest/en/campaign/manage-content/template-kit/template-kit.htm&quot; title=&quot;Episerver User Guide&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Template Kit&lt;/a&gt;. This also lets you personalize each content paragraph via target groups.&lt;/p&gt;
&lt;h2&gt;&lt;a id=&quot;start&quot;&gt;&lt;/a&gt;Starting the campaign&lt;/h2&gt;
&lt;p&gt;To send out the mailing, activate and start the campaign. Use the following operations:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Activating: &lt;a href=&quot;https://api.campaign.episerver.net/apidoc/index.html#/Smart%20Campaigns/activateSmartCampaign&quot; title=&quot;Episerver Campaign REST API&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;POST​/{clientId}​/smartcampaigns​/{campaignId}​/activate&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The request in curl looks as follows: &lt;br /&gt;&lt;br /&gt;
&lt;pre class=&quot;language-java&quot;&gt;&lt;code&gt;curl -X POST &quot;https://api.campaign.episerver.net/rest/123456789/smartcampaigns/12345654321/activate&quot; -H &quot;Authorization: BASIC k783r3fjn989dhnfjjdr83dgds1383NDfv=&quot;​&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Starting: &lt;a href=&quot;https://api.campaign.episerver.net/apidoc/index.html#/Smart%20Campaigns/startSmartCampaign&quot; title=&quot;Episerver Campaign REST API&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;POST​/{clientId}​/smartcampaigns​/{campaignId}​/start&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The request in curl looks as follows:&lt;br /&gt;&lt;br /&gt;
&lt;pre class=&quot;language-java&quot;&gt;&lt;code&gt;curl -X POST &quot;https://api.campaign.episerver.net/rest/123456789/smartcampaigns/12345654321/start&quot; -H &quot;Authorization: BASIC k783r3fjn989dhnfjjdr83dgds1383NDfv=&quot;​&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;greenBox&quot;&gt;&lt;strong&gt;Tip:&lt;/strong&gt; After sending out the campaign, you can retrieve a report with information about opens, clicks, unsubscribes and bounces by using the &lt;a href=&quot;https://api.campaign.episerver.net/apidoc/index.html#/Smart%20Campaigns/getReport_1&quot; title=&quot;Episerver Campaign REST API&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;GET​/{clientId}​/smartcampaigns​/{campaignId}​/report&lt;/a&gt; operation.&lt;/div&gt;</description>            <guid>https://world.optimizely.com/blogs/philipp-gaska/dates/2021/1/creating-a-smart-campaign-and-mailing-via-rest-api/</guid>            <pubDate>Fri, 15 Jan 2021 15:13:14 GMT</pubDate>           <category>Blog post</category></item><item> <title>Setting up a newsletter subscription via REST API</title>            <link>https://world.optimizely.com/blogs/philipp-gaska/dates/2020/12/setting-up-a-newsletter-subscription-via-rest-api/</link>            <description>&lt;p&gt;To expand your database of email recipients and attract new potential customers, newsletter subscriptions are essential. I recommend the &lt;a href=&quot;https://webhelp.episerver.com/latest/en/campaign/recipients/opt-in/opt-in.htm#Optinmethodtypes&quot; title=&quot;Episerver User Guide&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;double opt-in method&lt;/a&gt;, which ensures that the recipient really wants to receive promotional emails.&lt;/p&gt;
&lt;p&gt;This procedure works like this: When website visitors fill out the subscription form on your website and submit their contact information, they receive an email and are prompted to confirm the subscription by clicking the double opt-in link.&lt;/p&gt;
&lt;p&gt;To set up the subscription using the &lt;a href=&quot;/link/8693e50904d04f838570574aa64175e5.aspx&quot; title=&quot;Episerver Campaign REST API&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Episerver Campaign REST API&lt;/a&gt;, perform the following steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Create an opt-in recipient list&lt;/li&gt;
&lt;li&gt;Create an opt-in process&lt;/li&gt;
&lt;li&gt;Set up the subscription form&lt;/li&gt;
&lt;li&gt;Set up the REST API request&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;Creating an opt-in recipient list&lt;/h2&gt;
&lt;p&gt;To create an opt-in recipient list, you can use the &lt;a href=&quot;https://webhelp.episerver.com/latest/en/campaign/recipients/lists/recipient-lists-new.htm&quot; title=&quot;Episerver User Guide&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;recipient list management&lt;/a&gt; feature in Episerver Campaign. If you do not have enabled this feature in your client, you can also request an opt-in recipient list from customer support.&lt;/p&gt;
&lt;p&gt;For an opt-in recipient list, at least the recipient list field &quot;Email&quot; must be assigned. This field is used for the recipient ID. Also, set the list type to &quot;Opt-in&quot;.&lt;/p&gt;
&lt;h2&gt;Creating an opt-in process&lt;/h2&gt;
&lt;p&gt;To create an opt-in process, you can use the &lt;a href=&quot;https://webhelp.episerver.com/latest/en/campaign/omnichannel/confirmations.htm&quot; title=&quot;Episerver User Guide&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;opt-in process self-service&lt;/a&gt; in Episerver Campaign. When creating, you specify the opt-in recipient list you created earlier, and add the double opt-in link to the opt-in email.&lt;/p&gt;
&lt;h2&gt;Setting up the subscription form&lt;/h2&gt;
&lt;p&gt;Set up a form on your website for collecting the website visitor&amp;rsquo;s contact data. Create at least an input field for the email address. The more recipient data you collect, the more precisely you can individualize and personalize newsletters. For example, you can add additional fields for the first name, last name, and salutation.&lt;/p&gt;
&lt;p&gt;Each input field in the form must have a corresponding recipient list field into which the data is imported. For more information and tips on creating subscription forms, see the &lt;a href=&quot;https://webhelp.episerver.com/latest/en/campaign/recipients/opt-in/subscribe-unsubscribe.htm#AnundAbmeldeformulareerstellen&quot; title=&quot;Episerver User Guide&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Episerver User Guide&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The following example shows a basic HTML subscription form:&lt;/p&gt;
&lt;pre class=&quot;language-xml&quot;&gt;&lt;code&gt;&amp;lt;html lang=&quot;en&quot;&amp;gt;
&amp;lt;head&amp;gt;
  &amp;lt;title&amp;gt;Newsletter subscription&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;h1 style=&quot;font-family: Arial, sans-serif&quot;&amp;gt;Newsletter subscription&amp;lt;/h1&amp;gt;
    &amp;lt;p style=&quot;font-family: Arial, sans-serif&quot;&amp;gt;To stay up to date on special offers and promotions, subscribe now!&amp;lt;/p&amp;gt;
    &amp;lt;form action=&quot;&quot; method=&quot;post&quot;&amp;gt;
     &amp;lt;input style=&quot;font-family: Arial, sans-serif&quot; type=&quot;text&quot; name=&quot;email&quot; placeholder=&quot;Enter your email address&quot; size=&quot;30&quot;/&amp;gt;
     &amp;lt;input style=&quot;font-family: Arial, sans-serif&quot; type=&quot;submit&quot; name=&quot;subscribe&quot; value=&quot;Subscribe&quot;/&amp;gt;
    &amp;lt;/form&amp;gt;
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2&gt;Setting up the REST API request&lt;/h2&gt;
&lt;p&gt;To use the REST API, &lt;a href=&quot;/link/37288475a0884c6d9fe56a4717991432.aspx#client&quot; title=&quot;REST API documentation&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;set up your client&lt;/a&gt; first. Use the &lt;a href=&quot;https://api.campaign.episerver.net/apidoc/index.html#/Recipients/addRecipient&quot; title=&quot;Episerver Campaign REST API&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;POST​/{clientId}​/recipients​/{recipientListId}&lt;/a&gt; operation to add a new recipient to the opt-in recipient list. You can use the &quot;Try it out&quot; feature of our resource documentation to create and test the request.&lt;/p&gt;
&lt;p&gt;You need the following information for the request:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Client ID&lt;/strong&gt;. ID of the client the REST API is set up for.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Recipient ID&lt;/strong&gt;. Email address that the website visitor enters into the form.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Recipient list ID&lt;/strong&gt;. ID of the opt-in recipient list that is used for the double opt-in process.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Opt-in process ID&lt;/strong&gt;. ID of the double opt-in process.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;greenBox&quot;&gt;
&lt;p&gt;&lt;strong&gt;Tip:&lt;/strong&gt; You can find the IDs in Episerver Campaign under Administration &amp;gt; API overview. To retrieve the recipient list ID and the opt-in process ID, you can also use the &lt;a href=&quot;https://api.campaign.episerver.net/apidoc/index.html#/Recipient%20lists/selectRecipientLists&quot; title=&quot;Episerver Campaign REST API&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;GET​/{clientId}​/recipientlists&lt;/a&gt; and &lt;a href=&quot;https://api.campaign.episerver.net/apidoc/index.html#/Opt-in%20processes/selectOptinProcesses&quot; title=&quot;Episerver Campaign REST API&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;GET​/{clientId}​/optinprocesses&lt;/a&gt; operation.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;If you have additional fields, such as last name or salutation, add the corresponding parameters to the request. The following curl request only uses the email address, and the &lt;a href=&quot;/link/37288475a0884c6d9fe56a4717991432.aspx#auth&quot; title=&quot;REST API documentation&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt;Base64-encoded User:Password&lt;/a&gt; as authentication:&lt;/p&gt;
&lt;pre class=&quot;language-java&quot;&gt;&lt;code&gt;curl -X POST &quot;https://api.campaign.episerver.net/rest/123456789/recipients/987654321&quot; -H &quot;Authorization: BASIC k783r3fjn989dhnfjjdr83dgds1383NDfv=&quot; -d &quot;optinProcessId=12345654321&quot; -d &quot;recipientId={emailaddress}&quot;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Connect the API request with the subscription form, for example in a PHP file. Instead of using the Base64-encoded User:Password, add your API user and password directly into the PHP file.&lt;/p&gt;
&lt;p&gt;The following PHP example only shows a basic implementation. Also, make sure your form is secured from misuse by using a CAPTCHA, IP blocking or similar measures according to your usage scenario.&lt;/p&gt;
&lt;pre class=&quot;language-javascript&quot;&gt;&lt;code&gt;&amp;lt;?php
if(isset($_REQUEST[&#39;subscribe&#39;])){
$user = &#39;user@example.com&#39;; // API user name, usually your email address
$password = &#39;password1234&#39;; // password of your API user
$clientId = 123456789; // ID of the client the REST API is set up for
$recipientlistId = 987654321;  // ID of the opt-in recipient list that is used for the double opt-in process
$optinProcessId = 12345654321; // ID of the double opt-in process
$URL=&#39;https://api.broadmail.de/rest/&#39;.$clientId.&#39;/recipients/&#39;.$recipientlistId;

$curl = curl_init();
curl_setopt($curl, CURLOPT_URL,$URL);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_TIMEOUT, 30); //time out after 30 seconds
curl_setopt($curl, CURLOPT_RETURNTRANSFER,1);
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, &quot;$user:$password&quot;);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS,&quot;optinProcessId=&amp;rdquo;.$optinProcessId.&amp;rdquo;&amp;amp;recipientId=&quot;.$_REQUEST[&#39;email&#39;].&quot;&quot;);
$result = curl_exec ($curl);
print_r($result);
}
else
{
?&amp;gt;
    &amp;lt;html lang=&quot;en&quot;&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;Newsletter subscription&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
&amp;lt;h1 style=&quot;font-family: Arial, sans-serif&quot;&amp;gt;Newsletter subscription&amp;lt;/h1&amp;gt;
&amp;lt;p style=&quot;font-family: Arial, sans-serif&quot;&amp;gt;To stay up to date on special offers and promotions, subscribe now!&amp;lt;/p&amp;gt;
&amp;lt;form action=&quot;&quot; method=&quot;post&quot;&amp;gt;
    &amp;lt;input style=&quot;font-family: Arial, sans-serif&quot; type=&quot;text&quot; name=&quot;email&quot; placeholder=&quot;Enter your email address&quot; size=&quot;30&quot;/&amp;gt;
    &amp;lt;input style=&quot;font-family: Arial, sans-serif&quot; type=&quot;submit&quot; name=&quot;subscribe&quot; value=&quot;Subscribe&quot;/&amp;gt;
&amp;lt;/form&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&amp;lt;?php
}
?&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now, your newsletter subscription is complete. Publish the page with the subscription form on your website. When website visitors enter their email address and click on the &quot;Subscribe&quot; button, the double opt-in process is initiated and the visitors become mailing recipients.&lt;/p&gt;</description>            <guid>https://world.optimizely.com/blogs/philipp-gaska/dates/2020/12/setting-up-a-newsletter-subscription-via-rest-api/</guid>            <pubDate>Tue, 15 Dec 2020 13:46:45 GMT</pubDate>           <category>Blog post</category></item></channel>
</rss>