Campaigns

Last updated: February 7th 2019

Introduction

About Campaigns

A Campaign the mechanism used to send an email or SMS. As part of the campaign process, you create a campaign, create one or more designs, create one or more segments and create one or more broadcasts. This section details the API calls that can be used to create and send campaigns.

AddCampaign

This API call creates a campaign. Signin must be executed before any other service is executed. This establishes your identification for subsequent requests. The session will time out if the token is not used.

Authentication Endpoint
Method: POST
https://apinie.sensorpro.net/api/campaign/AddCampaign/[Token]

Copy to Clipboard

  • [Token] replace with the access token returned by the signin.
Header Values
Header Example Description
Content-Type application/json  

Request Body


    {
    "Title": "My API campaign",
    "Manager": "Joe blogs",
    "CampaignType": 0,
    "EndDate": "2021-12-04",
    "GoogleAnalytics": false,
    "DoNotTrackLinks": false,
    "Categories": false,
    "ServiceMessage": false,
    "EmailResultsAfter": 0,
    "EmailResultsMinSize": 0,
    "EmailResultsTo": "",
    "ExtLinkId": ""
    }

Input Parameters

    • Required
    • Title: campaign title
    • Manager: Name of the Campaign Manager
    • CampaignType: 0=Standard (Default), Pending = 10, Recurring = 30, Trigger = 40, SMS = 50, SMSRecurring = 60, SMSTrigger = 70
    • Optional
    • EndDate: Campaign end date format yyyy-mm-dd
    • GoogleAnalytics: (true|false) enable Google Analytics
    • DoNotTrackLinkss: (true|false) do not track links
    • ServiceMessage: This campaign will be used to send service messages, ignoring optout status
    • EmailResultsAfter: Number of days after broadcast which results will be emailed
    • EmailResultsMinSize: Only email results for broadcasts greater than x size. This prevents results being emailed for tests.
    • EmailResultsTo: Email address to receive results

Response Output


{  
   "CampaignId":12,
   "SegmentId":0,
   "BroadcastId":0,
   "DesignIdHTML":"00000000-0000-0000-0000-000000000000",
   "DesignIdTXT":"00000000-0000-0000-0000-000000000000",
   "Result":{  
      "RequestId":"db013449-b0b3-4d9b-b326-df0fd14ef19e",
      "ErrorMessages":[  

      ],
      "StatusMesssages":[  

      ],
      "TotalStatusMessages":0,
      "TotalErrors":0
   }
}
Response Values:
  • CampaignId - The id for this campaign this will be required as an input for any subsequent calls to AddDesign, AddSegment, AddBroadcast
  • BroadcastId - Broadcast Id, will always be 0 for this API call
  • DesignIdHTML - HTML design id will always be "00000000-0000-0000-0000-000000000000" for this API call
  • DesignIdTXT - Text design id Will always be "00000000-0000-0000-0000-000000000000" for this API call
Sample Code:

    var client = new RestClient("https://localhost:44319/api/Campaign/AddCampaign/4c7e91df-6c14-44de-9fad-c69329983ab9");
    client.Timeout = -1;
    var request = new RestRequest(Method.POST);
    request.AddHeader("Content-Type", "application/json");
    var body = @"{
    " + "\n" +
    @"    ""Title"": ""My API campaign"",
    " + "\n" +
    @"    ""Manager"": ""Joe blogs"",
    " + "\n" +
    @"    ""CampaignType"": 0,
    " + "\n" +
    @"    ""EndDate"": ""2021-12-04T09:27:58.2763655+00:00"",
    " + "\n" +
    @"    ""GoogleAnalytics"": false,
    " + "\n" +
    @"    ""DoNotTrackLinks"": false,
    " + "\n" +
    @"    ""Categories"": false,
    " + "\n" +
    @"    ""ServiceMessage"": false,
    " + "\n" +
    @"    ""EmailResultsAfter"": 0,
    " + "\n" +
    @"    ""EmailResultsMinSize"": 0,
    " + "\n" +
    @"    ""EmailResultsTo"": """",
    " + "\n" +
    @"    ""ExtLinkId"": """"
    " + "\n" +
    @"}";
    request.AddParameter("application/json", body,  ParameterType.RequestBody);
    IRestResponse response = client.Execute(request);
    Console.WriteLine(response.Content);


    curl --location --request POST 'https://localhost:44319/api/Campaign/AddCampaign/4c7e91df-6c14-44de-9fad-c69329983ab9' \
    --header 'Content-Type: application/json' \
    --data-raw '{
    "Title": "My API campaign",
    "Manager": "Joe blogs",
    "CampaignType": 0,
    "EndDate": "2021-12-04T09:27:58.2763655+00:00",
    "GoogleAnalytics": false,
    "DoNotTrackLinks": false,
    "Categories": false,
    "ServiceMessage": false,
    "EmailResultsAfter": 0,
    "EmailResultsMinSize": 0,
    "EmailResultsTo": "",
    "ExtLinkId": ""
    }'

                                            
            OkHttpClient client = new OkHttpClient().newBuilder()
            .build();
            MediaType mediaType = MediaType.parse("application/json");
            RequestBody body = RequestBody.create(mediaType, "{\r\n    \"Title\": \"My API campaign\",\r\n    \"Manager\": \"Joe blogs\",\r\n    \"CampaignType\": 0,\r\n    \"EndDate\": \"2021-12-04T09:27:58.2763655+00:00\",\r\n    \"GoogleAnalytics\": false,\r\n    \"DoNotTrackLinks\": false,\r\n    \"Categories\": false,\r\n    \"ServiceMessage\": false,\r\n    \"EmailResultsAfter\": 0,\r\n    \"EmailResultsMinSize\": 0,\r\n    \"EmailResultsTo\": \"\",\r\n    \"ExtLinkId\": \"\"\r\n}");
            Request request = new Request.Builder()
            .url("https://localhost:44319/api/Campaign/AddCampaign/4c7e91df-6c14-44de-9fad-c69329983ab9")
            .method("POST", body)
            .addHeader("Content-Type", "application/json")
            .build();
            Response response = client.newCall(request).execute();
        
        

AddDesign

Add a design to a campaign.

Add Design Endpoint
Method: POST
https://apinie.sensorpro.net/api/campaign/AddDesign/[Token]

Copy to Clipboard

  • [Token] replace with the access token returned by the signin.
Header Values
Header Example Description
Content-Type application/json  

Simple Sample Request


{
    "CampaignId": 183,
    "Name": "OnlyZToZ0To9Allowed",
    "DesignType": 20,
    "Description": "My november design",
    "HTMLMessageEncoded": "<table id="Layout56" class="ReadMsgBody tgOuter" style="table-layout: fixed; border-collapse: collapse; width: 100% !important; background-color: #ffffff;" border="0" cellspacing="0" cellpadding="0" align="center"><tbody><tr><td align="center"><table class="responsive-table tgInner" style="background-color: #ffffff; width: 600px; border-collapse: collapse;" border="0" cellspacing="0" cellpadding="0" align="center"><tbody><tr><td class="tgContainer" style="padding: 0 0 0 0;" align="center"><table class="responsive-table tgInner" style="border-collapse: collapse; background-color: #ffffff;" border="0" cellspacing="0" cellpadding="0"><tbody><tr><td class="header-image-cell" style="color: rgb(255, 255, 255); width: 600px; min-width: 600px; height: 115px;" align="center"><span class="mcEditImg" style="position: relative;"><img src="https://images.newsletter.ie/nclients/Images/logo-1200xcpy2xcrop1.png" alt="" class="" width="170" height="115" border="0" style="display: block; color: rgb(255, 255, 255); width: 170px; height: 115px; min-width: 170px; max-height: 115px;"></span></td></tr><tr><td class="tgContainer" style="padding: 25px 10px 5px 15px; font-size: 22px; font-family: Helvetica, Arial, sans-serif; color: #333333; text-align: center;" valign="top"><span class="mcEdit tgHeading1" style="position: relative; font-family: Helvetica; font-size: 28px;" spellcheck="false">Sample HTML Message</span></td></tr><tr><td class="tgContainer" style="padding: 15px; font-size: 14px; font-family: Helvetica, Arial, sans-serif; color: #333333; text-align: center;" valign="top"><span class="mcEdit tgBody" style="position: relative; font-family: Helvetica; font-size: 20px; color: rgb(51, 51, 51);" spellcheck="false">This is a text block for your feature article. This text will be the full width of your email and centred. Delete this text and add your own!</span></td></tr><tr><td class="tgContainer"><!-- BUTTON --><table class="mobile-button-container" style="width: 100%;" border="0" cellspacing="0" cellpadding="0"><tbody><tr><td class="padding-copy" style="padding: 15px 0 25px 0;" align="center"><table class="responsive-table tgInner tgButton" style="background-color: #ffffff;" border="0" cellspacing="0" cellpadding="0" align="center"><tbody><tr><td class="tgButtonDef" align="center" style="background-color: rgb(190, 146, 83);"><a class="mcEdit mobile-button" style="font-size: 18px; font-family: Helvetica; font-weight: normal; color: rgb(255, 255, 255); text-decoration: none; background-color: rgb(190, 146, 83); border-width: 15px 25px; border-style: solid; border-color: rgb(190, 146, 83); border-radius: 3px; display: inline-block; position: relative;" spellcheck="false" href="https://sensorpro.net" target="_blank" rel="noopener noreferrer" title="">Find out more ›</a></td></tr></tbody></table></td></tr></tbody></table><!-- END BUTTON --></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table>",
    "PlainTextMessage": "Email body if plain text email",
    "StyleSheet": "@import url('https://fonts.googleapis.com/css2?family=Prompt&display=swap');	@import url('https://fonts.googleapis.com/css2?family=Poppins&display=swap');         @font-face {             font-family: Futura;             font-weight: 700;             font-style: oblique;             src: url("https://cdn.jsdelivr.net/npm/futura-font@1.0.0/FuturaBT-Medium.woff") format("woff"),                  url("https://cdn.jsdelivr.net/npm/futura-font@1.0.0/FuturaBT-Medium.woff") format("woff");        }        /* Force Outlook to provide a "view in browser" message */#outlook a {padding:0;} /* Force width of 100% on main container tables */.ReadMsgBody {width:100% !important;}/* Force Hotmail to display emails at full width */.ExternalClass {width:100%;} /* Force Hotmail to display normal line spacing */.ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {line-height: 100%;} body, table, td {-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;}/* Prevent WebKit and Windows mobile changing default text sizes */a {-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;} /* Remove spacing between tables in Outlook 2007 and up */table, td {mso-table-lspace:0pt;mso-table-rspace:0pt;} /* Allow smoother rendering of resized image in Internet Explorer */img {-ms-interpolation-mode:bicubic;} /* RESET STYLES */body {margin:0;padding:0;}img {border:0;height:auto;outline:none;text-decoration:none;}table {border-collapse:collapse !important;}body {height:100% !important;margin:0;padding:0;width:100% !important;min-width:100% !important;}.webversion-link a {color:#777777;}/* iOS BLUE LINKS */.appleBody a {color:#777777;text-decoration: none;}.appleFooter a {color:#777777;text-decoration: none;}.img-mobile {display: none;}/* MOBILE STYLES */@media screen and (max-width: 525px) {/* ALLOWS FOR FLUID TABLES */.wrapper {width:100% !important;}/* ADJUSTS LAYOUT OF LOGO IMAGE */.logo {width: 90%;}/* ADJUSTS LAYOUT OF LOGO IMAGE */.webversion {}/* USE THESE CLASSES TO HIDE CONTENT ON MOBILE */.mobile-hide {display: none !important;}.img-max {max-width: 100% !important;height:auto !important;}.header-image-cell {width: 100% !important; min-width: 100% !important;height: auto !important;}.header-image-cell img {width: 100% !important;min-width: 100% !important; height: auto !important;}.img-mobile {display: block !important;}.img-desktop {display: none !important;}.tgFooterTable {border-right:none!important;}.footerright {text-align:center!important;}.footerleft {text-align:center!important;}/* FULL-WIDTH TABLES */.responsive-table {width:100% !important;min-width: 100% !important;}.tgInner {width:100% !important;}.tgButton {width:100% !important;}.tgBCHeight {width:100% !important;}.tgHeadingBlock {width:100% !important;}.responsive-table-footer {width:100% !important;}.responsive-table-3col {width:100% !important;text-align:center !important;margin-left:auto !important;margin-right:auto !important;}/* UTILITY CLASSES FOR ADJUSTING PADDING ON MOBILE */.padding {padding: 10px 5% 15px 5% !important;}.padding-copy {padding: 10px 5% 10px 5% !important;}.padding-meta {padding: 30px 5% 0px 5% !important;text-align: center;}.no-pad {padding: 0 0 20px 0 !important;}.no-padding {padding: 0 !important;}.section-padding {padding: 20px 10px 50px 10px !important;}.section-padding-bottom-image {padding: 50px 15px 0 15px !important;}/* ADJUST BUTTONS ON MOBILE */.mobile-wrapper {padding: 10px 5% 15px 5% !important;}.mobile-button-container {margin:0 auto;width:100% !important;}.mobile-button {width:80% !important;padding: 15px !important;border: 0 !important;font-size: 16px !important;}}",
    "HTMLMessageWidth": 650,
    "HTMLMessageBorderStyle": "",
    "TextMessage": "My text version {unsubscribe}",
    "ExtLinkId": "",
    "SaveAsTemplate": false
}

Input Parameters

  • Required
  • CampaignID - the campaign ID which design should be added
  • Name - design name. We recommend making these unique. Only a-z and 0-9 are valid characters
  • DesignType - HTMLMessage = 20, TxtMessage = 25
  • Description - design description. We recommend making these unique.
  • HTMLMessage - if design type is HTMLMessage HTML text for message. This needs to be html encoded. You can also set text version for html message for multi part emails.
  • TextMessage - If design type is TxtMessage text version version of email
  • Optional
  • Stylesheet - the style sheet which goes with the design
  • SaveAsTemplate - Save as a template
  • ExtLinkId - link back to your external system. If a design with this external ID already exists the design will not be added.

Response Output

The key return values are DesignIdHTML and DesignIdTXT. These will be used to create a broadcast in a subsequent API call.


{
    "CampaignId": 2,
    "SegmentId": 0,
    "BroadcastId": 0,
    "DesignIdHTML": "0fb2d826-289f-40d4-a232-6c8557b2a457",
    "DesignIdTXT": "00000000-0000-0000-0000-000000000000",
    "Result": {
        "RequestId": "c1d0d891-fcc1-4b17-b854-d5bd6656f8c9",
        "ErrorMessages": [],
        "StatusMesssages": [],
        "TotalStatusMessages": 0,
        "TotalErrors": 0
    }
}

Response Values:
  • CampaignId - Campaign ID
  • SegmentId - Segment ID will always be 0 for this API call
  • BroadcastId - Broadcast ID will always be 0 for this API call
  • DesignIdHTML - This will be populated with the Design ID. This is required input for AddBroadcat.
  • DesignIdTXT - This will be populated with the Design ID if a HTML design is also created.
Sample Code:

    var client = new RestClient("https://localhost:44319/api/Campaign/adddesign/66f10516-f407-40ed-b06a-2f26ae35125b");
    client.Timeout = -1;
    var request = new RestRequest(Method.POST);
    request.AddHeader("Content-Type", "application/json");
    var body = @"{
    " + "\n" +
    @"    ""CampaignId"": 183,
    " + "\n" +
    @"    ""Name"": ""OnlyZToZ0To9Allowed"",
    " + "\n" +
    @"    ""DesignType"": 20,
    " + "\n" +
    @"    ""Description"": ""My november design"",
    " + "\n" +
    @"    ""HTMLMessageEncoded"": ""<table id="Layout56" class="ReadMsgBody tgOuter" style="table-layout: fixed; border-collapse: collapse; width: 100% !important; background-color: #ffffff;" border="0" cellspacing="0" cellpadding="0" align="center"><tbody><tr><td align="center"><table class="responsive-table tgInner" style="background-color: #ffffff; width: 600px; border-collapse: collapse;" border="0" cellspacing="0" cellpadding="0" align="center"><tbody><tr><td class="tgContainer" style="padding: 0 0 0 0;" align="center"><table class="responsive-table tgInner" style="border-collapse: collapse; background-color: #ffffff;" border="0" cellspacing="0" cellpadding="0"><tbody><tr><td class="header-image-cell" style="color: rgb(255, 255, 255); width: 600px; min-width: 600px; height: 115px;" align="center"><span class="mcEditImg" style="position: relative;"><img src="https://images.newsletter.ie/nclients/Images/logo-1200xcpy2xcrop1.png" alt="" class="" width="170" height="115" border="0" style="display: block; color: rgb(255, 255, 255); width: 170px; height: 115px; min-width: 170px; max-height: 115px;"></span></td></tr><tr><td class="tgContainer" style="padding: 25px 10px 5px 15px; font-size: 22px; font-family: Helvetica, Arial, sans-serif; color: #333333; text-align: center;" valign="top"><span class="mcEdit tgHeading1" style="position: relative; font-family: Helvetica; font-size: 28px;" spellcheck="false">Sample HTML Message</span></td></tr><tr><td class="tgContainer" style="padding: 15px; font-size: 14px; font-family: Helvetica, Arial, sans-serif; color: #333333; text-align: center;" valign="top"><span class="mcEdit tgBody" style="position: relative; font-family: Helvetica; font-size: 20px; color: rgb(51, 51, 51);" spellcheck="false">This is a text block for your feature article. This text will be the full width of your email and centred. Delete this text and add your own!</span></td></tr><tr><td class="tgContainer"><!-- BUTTON --><table class="mobile-button-container" style="width: 100%;" border="0" cellspacing="0" cellpadding="0"><tbody><tr><td class="padding-copy" style="padding: 15px 0 25px 0;" align="center"><table class="responsive-table tgInner tgButton" style="background-color: #ffffff;" border="0" cellspacing="0" cellpadding="0" align="center"><tbody><tr><td class="tgButtonDef" align="center" style="background-color: rgb(190, 146, 83);"><a class="mcEdit mobile-button" style="font-size: 18px; font-family: Helvetica; font-weight: normal; color: rgb(255, 255, 255); text-decoration: none; background-color: rgb(190, 146, 83); border-width: 15px 25px; border-style: solid; border-color: rgb(190, 146, 83); border-radius: 3px; display: inline-block; position: relative;" spellcheck="false" href="https://sensorpro.net" target="_blank" rel="noopener noreferrer" title="">Find out more ›</a></td></tr></tbody></table></td></tr></tbody></table><!-- END BUTTON --></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table>"",
    " + "\n" +
    @"        ""PlainTextMessage"": ""Email body if plain text email"",
    " + "\n" +
    @"    ""StyleSheet"": ""@import url('https://fonts.googleapis.com/css2?family=Prompt&display=swap');	@import url('https://fonts.googleapis.com/css2?family=Poppins&display=swap');         @font-face {             font-family: Futura;             font-weight: 700;             font-style: oblique;             src: url("https://cdn.jsdelivr.net/npm/futura-font@1.0.0/FuturaBT-Medium.woff") format("woff"),                  url("https://cdn.jsdelivr.net/npm/futura-font@1.0.0/FuturaBT-Medium.woff") format("woff");        }        /* Force Outlook to provide a "view in browser" message */#outlook a {padding:0;} /* Force width of 100% on main container tables */.ReadMsgBody {width:100% !important;}/* Force Hotmail to display emails at full width */.ExternalClass {width:100%;} /* Force Hotmail to display normal line spacing */.ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {line-height: 100%;} body, table, td {-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;}/* Prevent WebKit and Windows mobile changing default text sizes */a {-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;} /* Remove spacing between tables in Outlook 2007 and up */table, td {mso-table-lspace:0pt;mso-table-rspace:0pt;} /* Allow smoother rendering of resized image in Internet Explorer */img {-ms-interpolation-mode:bicubic;} /* RESET STYLES */body {margin:0;padding:0;}img {border:0;height:auto;outline:none;text-decoration:none;}table {border-collapse:collapse !important;}body {height:100% !important;margin:0;padding:0;width:100% !important;min-width:100% !important;}.webversion-link a {color:#777777;}/* iOS BLUE LINKS */.appleBody a {color:#777777;text-decoration: none;}.appleFooter a {color:#777777;text-decoration: none;}.img-mobile {display: none;}/* MOBILE STYLES */@media screen and (max-width: 525px) {/* ALLOWS FOR FLUID TABLES */.wrapper {width:100% !important;}/* ADJUSTS LAYOUT OF LOGO IMAGE */.logo {width: 90%;}/* ADJUSTS LAYOUT OF LOGO IMAGE */.webversion {}/* USE THESE CLASSES TO HIDE CONTENT ON MOBILE */.mobile-hide {display: none !important;}.img-max {max-width: 100% !important;height:auto !important;}.header-image-cell {width: 100% !important; min-width: 100% !important;height: auto !important;}.header-image-cell img {width: 100% !important;min-width: 100% !important; height: auto !important;}.img-mobile {display: block !important;}.img-desktop {display: none !important;}.tgFooterTable {border-right:none!important;}.footerright {text-align:center!important;}.footerleft {text-align:center!important;}/* FULL-WIDTH TABLES */.responsive-table {width:100% !important;min-width: 100% !important;}.tgInner {width:100% !important;}.tgButton {width:100% !important;}.tgBCHeight {width:100% !important;}.tgHeadingBlock {width:100% !important;}.responsive-table-footer {width:100% !important;}.responsive-table-3col {width:100% !important;text-align:center !important;margin-left:auto !important;margin-right:auto !important;}/* UTILITY CLASSES FOR ADJUSTING PADDING ON MOBILE */.padding {padding: 10px 5% 15px 5% !important;}.padding-copy {padding: 10px 5% 10px 5% !important;}.padding-meta {padding: 30px 5% 0px 5% !important;text-align: center;}.no-pad {padding: 0 0 20px 0 !important;}.no-padding {padding: 0 !important;}.section-padding {padding: 20px 10px 50px 10px !important;}.section-padding-bottom-image {padding: 50px 15px 0 15px !important;}/* ADJUST BUTTONS ON MOBILE */.mobile-wrapper {padding: 10px 5% 15px 5% !important;}.mobile-button-container {margin:0 auto;width:100% !important;}.mobile-button {width:80% !important;padding: 15px !important;border: 0 !important;font-size: 16px !important;}}"",
    " + "\n" +
    @"    ""HTMLMessageWidth"": 650,
    " + "\n" +
    @"    ""HTMLMessageBorderStyle"": """",
    " + "\n" +
    @"    ""TextMessage"": ""My text version {unsubscribe}"",
    " + "\n" +
    @"    ""ExtLinkId"": """",
    " + "\n" +
    @"    ""SaveAsTemplate"": false
    " + "\n" +
    @"}";
    request.AddParameter("application/json", body,  ParameterType.RequestBody);
    IRestResponse response = client.Execute(request);
    Console.WriteLine(response.Content);


    &curl --location --request POST 'https://localhost:44319/api/Campaign/adddesign/66f10516-f407-40ed-b06a-2f26ae35125b' \
    --header 'Content-Type: application/json' \
    --data-raw '{
    "CampaignId": 183,
    "Name": "OnlyZToZ0To9Allowed",
    "DesignType": 20,
    "Description": "My november design",
    "HTMLMessageEncoded": "<table id="Layout56" class="ReadMsgBody tgOuter" style="table-layout: fixed; border-collapse: collapse; width: 100% !important; background-color: #ffffff;" border="0" cellspacing="0" cellpadding="0" align="center"><tbody><tr><td align="center"><table class="responsive-table tgInner" style="background-color: #ffffff; width: 600px; border-collapse: collapse;" border="0" cellspacing="0" cellpadding="0" align="center"><tbody><tr><td class="tgContainer" style="padding: 0 0 0 0;" align="center"><table class="responsive-table tgInner" style="border-collapse: collapse; background-color: #ffffff;" border="0" cellspacing="0" cellpadding="0"><tbody><tr><td class="header-image-cell" style="color: rgb(255, 255, 255); width: 600px; min-width: 600px; height: 115px;" align="center"><span class="mcEditImg" style="position: relative;"><img src="https://images.newsletter.ie/nclients/Images/logo-1200xcpy2xcrop1.png" alt="" class="" width="170" height="115" border="0" style="display: block; color: rgb(255, 255, 255); width: 170px; height: 115px; min-width: 170px; max-height: 115px;"></span></td></tr><tr><td class="tgContainer" style="padding: 25px 10px 5px 15px; font-size: 22px; font-family: Helvetica, Arial, sans-serif; color: #333333; text-align: center;" valign="top"><span class="mcEdit tgHeading1" style="position: relative; font-family: Helvetica; font-size: 28px;" spellcheck="false">Sample HTML Message</span></td></tr><tr><td class="tgContainer" style="padding: 15px; font-size: 14px; font-family: Helvetica, Arial, sans-serif; color: #333333; text-align: center;" valign="top"><span class="mcEdit tgBody" style="position: relative; font-family: Helvetica; font-size: 20px; color: rgb(51, 51, 51);" spellcheck="false">This is a text block for your feature article. This text will be the full width of your email and centred. Delete this text and add your own!</span></td></tr><tr><td class="tgContainer"><!-- BUTTON --><table class="mobile-button-container" style="width: 100%;" border="0" cellspacing="0" cellpadding="0"><tbody><tr><td class="padding-copy" style="padding: 15px 0 25px 0;" align="center"><table class="responsive-table tgInner tgButton" style="background-color: #ffffff;" border="0" cellspacing="0" cellpadding="0" align="center"><tbody><tr><td class="tgButtonDef" align="center" style="background-color: rgb(190, 146, 83);"><a class="mcEdit mobile-button" style="font-size: 18px; font-family: Helvetica; font-weight: normal; color: rgb(255, 255, 255); text-decoration: none; background-color: rgb(190, 146, 83); border-width: 15px 25px; border-style: solid; border-color: rgb(190, 146, 83); border-radius: 3px; display: inline-block; position: relative;" spellcheck="false" href="https://sensorpro.net" target="_blank" rel="noopener noreferrer" title="">Find out more ›</a></td></tr></tbody></table></td></tr></tbody></table><!-- END BUTTON --></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table>",
    "PlainTextMessage": "Email body if plain text email",
    "StyleSheet": "@import url('https://fonts.googleapis.com/css2?family=Prompt&display=swap');	@import url('https://fonts.googleapis.com/css2?family=Poppins&display=swap');         @font-face {             font-family: Futura;             font-weight: 700;             font-style: oblique;             src: url("https://cdn.jsdelivr.net/npm/futura-font@1.0.0/FuturaBT-Medium.woff") format("woff"),                  url("https://cdn.jsdelivr.net/npm/futura-font@1.0.0/FuturaBT-Medium.woff") format("woff");        }        /* Force Outlook to provide a "view in browser" message */#outlook a {padding:0;} /* Force width of 100% on main container tables */.ReadMsgBody {width:100% !important;}/* Force Hotmail to display emails at full width */.ExternalClass {width:100%;} /* Force Hotmail to display normal line spacing */.ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {line-height: 100%;} body, table, td {-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;}/* Prevent WebKit and Windows mobile changing default text sizes */a {-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;} /* Remove spacing between tables in Outlook 2007 and up */table, td {mso-table-lspace:0pt;mso-table-rspace:0pt;} /* Allow smoother rendering of resized image in Internet Explorer */img {-ms-interpolation-mode:bicubic;} /* RESET STYLES */body {margin:0;padding:0;}img {border:0;height:auto;outline:none;text-decoration:none;}table {border-collapse:collapse !important;}body {height:100% !important;margin:0;padding:0;width:100% !important;min-width:100% !important;}.webversion-link a {color:#777777;}/* iOS BLUE LINKS */.appleBody a {color:#777777;text-decoration: none;}.appleFooter a {color:#777777;text-decoration: none;}.img-mobile {display: none;}/* MOBILE STYLES */@media screen and (max-width: 525px) {/* ALLOWS FOR FLUID TABLES */.wrapper {width:100% !important;}/* ADJUSTS LAYOUT OF LOGO IMAGE */.logo {width: 90%;}/* ADJUSTS LAYOUT OF LOGO IMAGE */.webversion {}/* USE THESE CLASSES TO HIDE CONTENT ON MOBILE */.mobile-hide {display: none !important;}.img-max {max-width: 100% !important;height:auto !important;}.header-image-cell {width: 100% !important; min-width: 100% !important;height: auto !important;}.header-image-cell img {width: 100% !important;min-width: 100% !important; height: auto !important;}.img-mobile {display: block !important;}.img-desktop {display: none !important;}.tgFooterTable {border-right:none!important;}.footerright {text-align:center!important;}.footerleft {text-align:center!important;}/* FULL-WIDTH TABLES */.responsive-table {width:100% !important;min-width: 100% !important;}.tgInner {width:100% !important;}.tgButton {width:100% !important;}.tgBCHeight {width:100% !important;}.tgHeadingBlock {width:100% !important;}.responsive-table-footer {width:100% !important;}.responsive-table-3col {width:100% !important;text-align:center !important;margin-left:auto !important;margin-right:auto !important;}/* UTILITY CLASSES FOR ADJUSTING PADDING ON MOBILE */.padding {padding: 10px 5% 15px 5% !important;}.padding-copy {padding: 10px 5% 10px 5% !important;}.padding-meta {padding: 30px 5% 0px 5% !important;text-align: center;}.no-pad {padding: 0 0 20px 0 !important;}.no-padding {padding: 0 !important;}.section-padding {padding: 20px 10px 50px 10px !important;}.section-padding-bottom-image {padding: 50px 15px 0 15px !important;}/* ADJUST BUTTONS ON MOBILE */.mobile-wrapper {padding: 10px 5% 15px 5% !important;}.mobile-button-container {margin:0 auto;width:100% !important;}.mobile-button {width:80% !important;padding: 15px !important;border: 0 !important;font-size: 16px !important;}}",
    "HTMLMessageWidth": 650,
    "HTMLMessageBorderStyle": "",
    "TextMessage": "My text version {unsubscribe}",
    "ExtLinkId": "",
    "SaveAsTemplate": false
    }'

OkHttpClient client = new OkHttpClient().newBuilder() .build(); MediaType mediaType = MediaType.parse("application/json"); RequestBody body = RequestBody.create(mediaType, "{\r\n \"CampaignId\": 183,\r\n \"Name\": \"OnlyZToZ0To9Allowed\",\r\n \"DesignType\": 20,\r\n \"Description\": \"My november design\",\r\n \"HTMLMessageEncoded\": \"<table id="Layout56" class="ReadMsgBody tgOuter" style="table-layout: fixed; border-collapse: collapse; width: 100% !important; background-color: #ffffff;" border="0" cellspacing="0" cellpadding="0" align="center"><tbody><tr><td align="center"><table class="responsive-table tgInner" style="background-color: #ffffff; width: 600px; border-collapse: collapse;" border="0" cellspacing="0" cellpadding="0" align="center"><tbody><tr><td class="tgContainer" style="padding: 0 0 0 0;" align="center"><table class="responsive-table tgInner" style="border-collapse: collapse; background-color: #ffffff;" border="0" cellspacing="0" cellpadding="0"><tbody><tr><td class="header-image-cell" style="color: rgb(255, 255, 255); width: 600px; min-width: 600px; height: 115px;" align="center"><span class="mcEditImg" style="position: relative;"><img src="https://images.newsletter.ie/nclients/Images/logo-1200xcpy2xcrop1.png" alt="" class="" width="170" height="115" border="0" style="display: block; color: rgb(255, 255, 255); width: 170px; height: 115px; min-width: 170px; max-height: 115px;"></span></td></tr><tr><td class="tgContainer" style="padding: 25px 10px 5px 15px; font-size: 22px; font-family: Helvetica, Arial, sans-serif; color: #333333; text-align: center;" valign="top"><span class="mcEdit tgHeading1" style="position: relative; font-family: Helvetica; font-size: 28px;" spellcheck="false">Sample HTML Message</span></td></tr><tr><td class="tgContainer" style="padding: 15px; font-size: 14px; font-family: Helvetica, Arial, sans-serif; color: #333333; text-align: center;" valign="top"><span class="mcEdit tgBody" style="position: relative; font-family: Helvetica; font-size: 20px; color: rgb(51, 51, 51);" spellcheck="false">This is a text block for your feature article. This text will be the full width of your email and centred. Delete this text and add your own!</span></td></tr><tr><td class="tgContainer"><!-- BUTTON --><table class="mobile-button-container" style="width: 100%;" border="0" cellspacing="0" cellpadding="0"><tbody><tr><td class="padding-copy" style="padding: 15px 0 25px 0;" align="center"><table class="responsive-table tgInner tgButton" style="background-color: #ffffff;" border="0" cellspacing="0" cellpadding="0" align="center"><tbody><tr><td class="tgButtonDef" align="center" style="background-color: rgb(190, 146, 83);"><a class="mcEdit mobile-button" style="font-size: 18px; font-family: Helvetica; font-weight: normal; color: rgb(255, 255, 255); text-decoration: none; background-color: rgb(190, 146, 83); border-width: 15px 25px; border-style: solid; border-color: rgb(190, 146, 83); border-radius: 3px; display: inline-block; position: relative;" spellcheck="false" href="https://sensorpro.net" target="_blank" rel="noopener noreferrer" title="">Find out more ›</a></td></tr></tbody></table></td></tr></tbody></table><!-- END BUTTON --></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table>\",\r\n \"PlainTextMessage\": \"Email body if plain text email\",\r\n \"StyleSheet\": \"@import url('https://fonts.googleapis.com/css2?family=Prompt&display=swap');\t@import url('https://fonts.googleapis.com/css2?family=Poppins&display=swap'); @font-face { font-family: Futura; font-weight: 700; font-style: oblique; src: url("https://cdn.jsdelivr.net/npm/futura-font@1.0.0/FuturaBT-Medium.woff") format("woff"), url("https://cdn.jsdelivr.net/npm/futura-font@1.0.0/FuturaBT-Medium.woff") format("woff"); } /* Force Outlook to provide a "view in browser" message */#outlook a {padding:0;} /* Force width of 100% on main container tables */.ReadMsgBody {width:100% !important;}/* Force Hotmail to display emails at full width */.ExternalClass {width:100%;} /* Force Hotmail to display normal line spacing */.ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {line-height: 100%;} body, table, td {-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;}/* Prevent WebKit and Windows mobile changing default text sizes */a {-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;} /* Remove spacing between tables in Outlook 2007 and up */table, td {mso-table-lspace:0pt;mso-table-rspace:0pt;} /* Allow smoother rendering of resized image in Internet Explorer */img {-ms-interpolation-mode:bicubic;} /* RESET STYLES */body {margin:0;padding:0;}img {border:0;height:auto;outline:none;text-decoration:none;}table {border-collapse:collapse !important;}body {height:100% !important;margin:0;padding:0;width:100% !important;min-width:100% !important;}.webversion-link a {color:#777777;}/* iOS BLUE LINKS */.appleBody a {color:#777777;text-decoration: none;}.appleFooter a {color:#777777;text-decoration: none;}.img-mobile {display: none;}/* MOBILE STYLES */@media screen and (max-width: 525px) {/* ALLOWS FOR FLUID TABLES */.wrapper {width:100% !important;}/* ADJUSTS LAYOUT OF LOGO IMAGE */.logo {width: 90%;}/* ADJUSTS LAYOUT OF LOGO IMAGE */.webversion {}/* USE THESE CLASSES TO HIDE CONTENT ON MOBILE */.mobile-hide {display: none !important;}.img-max {max-width: 100% !important;height:auto !important;}.header-image-cell {width: 100% !important; min-width: 100% !important;height: auto !important;}.header-image-cell img {width: 100% !important;min-width: 100% !important; height: auto !important;}.img-mobile {display: block !important;}.img-desktop {display: none !important;}.tgFooterTable {border-right:none!important;}.footerright {text-align:center!important;}.footerleft {text-align:center!important;}/* FULL-WIDTH TABLES */.responsive-table {width:100% !important;min-width: 100% !important;}.tgInner {width:100% !important;}.tgButton {width:100% !important;}.tgBCHeight {width:100% !important;}.tgHeadingBlock {width:100% !important;}.responsive-table-footer {width:100% !important;}.responsive-table-3col {width:100% !important;text-align:center !important;margin-left:auto !important;margin-right:auto !important;}/* UTILITY CLASSES FOR ADJUSTING PADDING ON MOBILE */.padding {padding: 10px 5% 15px 5% !important;}.padding-copy {padding: 10px 5% 10px 5% !important;}.padding-meta {padding: 30px 5% 0px 5% !important;text-align: center;}.no-pad {padding: 0 0 20px 0 !important;}.no-padding {padding: 0 !important;}.section-padding {padding: 20px 10px 50px 10px !important;}.section-padding-bottom-image {padding: 50px 15px 0 15px !important;}/* ADJUST BUTTONS ON MOBILE */.mobile-wrapper {padding: 10px 5% 15px 5% !important;}.mobile-button-container {margin:0 auto;width:100% !important;}.mobile-button {width:80% !important;padding: 15px !important;border: 0 !important;font-size: 16px !important;}}\",\r\n \"HTMLMessageWidth\": 650,\r\n \"HTMLMessageBorderStyle\": \"\",\r\n \"TextMessage\": \"My text version {unsubscribe}\",\r\n \"ExtLinkId\": \"\",\r\n \"SaveAsTemplate\": false\r\n}"); Request request = new Request.Builder() .url("https://localhost:44319/api/Campaign/adddesign/66f10516-f407-40ed-b06a-2f26ae35125b") .method("POST", body) .addHeader("Content-Type", "application/json") .build(); Response response = client.newCall(request).execute();

AddSegment

Add a segment to a campaign.

AddSegment Endpoint
Method: POST
https://apinie.sensorpro.net/api/campaign/AddSegment/[Token]

Copy to Clipboard

  • [Token] replace with the access token returned by the signin.
Header Values
Header Example Description
Content-Type application/json  

Sample Request (Select all contacts in a list)


{
    "CampaignId": 183,
    "SegmentName": "MySeedSegments",
    "Description": "API Seed Segmentx",
    "SegmentType": 0,
    "MultiStep": false,
    "Restricted": false,
    "ActiveOnly": true,
    "ReBuildBeforeBroadcast": true,
    "CustomRule": [
    ],
    "RuleSeedList": "",
    "RuleImportName": "MYLIST",
    "ExtLinkId": "",
    "DupEmailInDays": -1
}


Sample Request (Simple rule select a contact)


{
    "CampaignId": 183,
    "SegmentName": "MySeedSegments",
    "Description": "API Seed Segmentx",
    "SegmentType": 20,
    "MultiStep": false,
    "Restricted": false,
    "ActiveOnly": true,
    "ReBuildBeforeBroadcast": true,
    "CustomRule": [
        {
        "Field": "Personalemail",
        "Condition": "=",
        "Value": "my@gmail.com",
        "AndOrNext": 0
        }
    ],
    "RuleSeedList": "",
    "RuleImportName": "",
    "ExtLinkId": "",
    "DupEmailInDays": -1
}


Key Input Parameters

  • Required
  • CampaignId - the campaign id which design should be added
  • SegmentName - Segment name.
  • Segment Type
    • Import=0 (You must set the RuleImportName if targeting a specific import. That is the import name)
    • Seed List=10
    • Everyone=30
    • CustomRule=20
  • Description Segment description
  • Optional
  • MultiStep - Multistep segment. Always false;
  • Restricted - This forces uniqueness across all segments in the campaign. Segments should be built one at a time.
  • ActiveOnly - Only include active contacts in the segment (NOT opted out and not bounced)
  • DupEmailInDays - Number of days since last broadcast. If someone was broadcast to within x days, exclude them. Default value is -1.
  • CustomRule (this is an array of condition)
    • Field Field name
    • Condition <,>, =, Like, NotLike, Is Null, Is Not Null
    • Value The condition value
    • AndOrNext AND, OR

Response Output

The key return value is SegmentId - this will be used to create a broadcast in a subsequent API call.

{  
   "CampaignId":12,
   "SegmentId":27,
   "BroadcastId":0,
   "DesignIdHTML":"00000000-0000-0000-0000-000000000000",
   "DesignIdTXT":"00000000-0000-0000-0000-000000000000",
   "Result":{  
      "RequestId":"0ad53069-1a30-43f4-9626-148d112d7451",
      "ErrorMessages":[  
      ],
      "StatusMesssages":[  
      ],
      "TotalStatusMessages":0,
      "TotalErrors":0
   }
}


Response Values:
  • CampaignId - Campaign id.
  • SegmentId - The segment id of the newly created segment.
  • BroadcastId - This will be 0 for this api call.
  • DesignIdHTML - This will not be set for this api call.
  • DesignIdTXT - This will not be set for this api call.
Sample Code:

    var client = new RestClient("https://localhost:44319/api/Campaign/addbroadcast/3a3867ac-b9a2-41c6-9947-b44256a05bf0");
    client.Timeout = -1;
    var request = new RestRequest(Method.POST);
    request.AddHeader("Content-Type", "application/json");
    var body = @"{
    " + "\n" +
    @"    ""CampaignId"": 183,
    " + "\n" +
    @"    ""SegmentName"": ""MySeedSegments"",
    " + "\n" +
    @"    ""Description"": ""API Seed Segmentx"",
    " + "\n" +
    @"    ""SegmentType"": 20,
    " + "\n" +
    @"    ""MultiStep"": false,
    " + "\n" +
    @"    ""Restricted"": false,
    " + "\n" +
    @"    ""ActiveOnly"": true,
    " + "\n" +
    @"    ""ReBuildBeforeBroadcast"": true,
    " + "\n" +
    @"    ""CustomRule"": [
    " + "\n" +
    @"        {
    " + "\n" +
    @"            ""Field"": ""Personalemail"",
    " + "\n" +
    @"            ""Condition"": ""="",
    " + "\n" +
    @"            ""Value"": ""rcoady@gmail.com"",
    " + "\n" +
    @"            ""AndOrNext"": 0
    " + "\n" +
    @"        }
    " + "\n" +
    @"    ],
    " + "\n" +
    @"    ""RuleSeedList"": """",
    " + "\n" +
    @"    ""RuleImportName"": ""EpicorBAQ2021Sept"",
    " + "\n" +
    @"    ""ExtLinkId"": """",
    " + "\n" +
    @"    ""DupEmailInDays"": -1
    " + "\n" +
    @"}";
    request.AddParameter("application/json", body,  ParameterType.RequestBody);
    IRestResponse response = client.Execute(request);
    Console.WriteLine(response.Content);


    curl --location --request POST 'https://localhost:44319/api/Campaign/addbroadcast/3a3867ac-b9a2-41c6-9947-b44256a05bf0' \
    --header 'Content-Type: application/json' \
    --data-raw '{
    "CampaignId": 183,
    "SegmentName": "MySeedSegments",
    "Description": "API Seed Segmentx",
    "SegmentType": 20,
    "MultiStep": false,
    "Restricted": false,
    "ActiveOnly": true,
    "ReBuildBeforeBroadcast": true,
    "CustomRule": [
    {
    "Field": "Personalemail",
    "Condition": "=",
    "Value": "rcoady@gmail.com",
    "AndOrNext": 0
    }
    ],
    "RuleSeedList": "",
    "RuleImportName": "EpicorBAQ2021Sept",
    "ExtLinkId": "",
    "DupEmailInDays": -1
    }'


    OkHttpClient client = new OkHttpClient().newBuilder()
    .build();
    MediaType mediaType = MediaType.parse("application/json");
    RequestBody body = RequestBody.create(mediaType, "{\r\n    \"CampaignId\": 183,\r\n    \"SegmentName\": \"MySeedSegments\",\r\n    \"Description\": \"API Seed Segmentx\",\r\n    \"SegmentType\": 20,\r\n    \"MultiStep\": false,\r\n    \"Restricted\": false,\r\n    \"ActiveOnly\": true,\r\n    \"ReBuildBeforeBroadcast\": true,\r\n    \"CustomRule\": [\r\n        {\r\n            \"Field\": \"Personalemail\",\r\n            \"Condition\": \"=\",\r\n            \"Value\": \"rcoady@gmail.com\",\r\n            \"AndOrNext\": 0\r\n        }\r\n    ],\r\n    \"RuleSeedList\": \"\",\r\n    \"RuleImportName\": \"EpicorBAQ2021Sept\",\r\n    \"ExtLinkId\": \"\",\r\n    \"DupEmailInDays\": -1\r\n}");
    Request request = new Request.Builder()
    .url("https://localhost:44319/api/Campaign/addbroadcast/3a3867ac-b9a2-41c6-9947-b44256a05bf0")
    .method("POST", body)
    .addHeader("Content-Type", "application/json")
    .build();
    Response response = client.newCall(request).execute();

AddBroadcast

Add a broadcast to a campaign.

AddBroadcast Endpoint
Method: POST
https://apinie.sensorpro.net/api/campaign/AddBroadcast/[Token]

Copy to Clipboard

  • [Token] replace with the access token returned by the signin.
Header Values
Header Example Description
Content-Type application/json  

Simple Sample Request


    {
    "CampaignId": 183,
    "SegmentId": 8925,
    "Subject": "My broadcast",
    "FromEmail": {
    "DisplayName": "marketing",
    "Email": "marketing@myco.net"
    },
    "ReplyTo": null,
    "DesignHtmlId": "abdfd06b-431d-49ef-85be-bb364b7bd5c7",
    "DesignTxtId": "00000000-0000-0000-0000-000000000000",
    "MsgType": 0,
    "MailEncoding": "UTF8",
    "ExecuteBroadcast": true,
    "ExecuteOnUTCFormat": null,
    "ExtLinkId": "",
    "BroadcastType ": 0
    }

Key Input Parameters

  • Required
  • CampaignID - The campaign ID which design should be added
  • SegmentId - Segment Id
  • FromEmail - From email Example "Sales" <salesemail@mycompany.com>. Note this email address have to be an authorized for sending.
  • Subject - Subject Line
  • DesignHTMLId - Id of the html design
  • MsgType - Set to 0 HTML message 10 Text message
  • Optional
  • DesignTxtId - Text design Id
  • ReplyTo - Reply to address
  • MailEncoding - Encoding "UFT8" is default
  • ExecuteOnUTCFormat - If scheduling set to a future date must be in UTC format
  • ExecuteBroadcast - True|False, True execute broadcast now, or schedule for future send
  • BroadcastType - 0 = Email 40 = SMS. Email is the default

Response Output

The key return values are BroadcastId - this is the internal ID for that broadcast


{
    "CampaignId": 2,
    "SegmentId": 4,
    "BroadcastId": 1,
    "DesignIdHTML": "0fb2d826-289f-40d4-a232-6c8557b2a457",
    "DesignIdTXT": "00000000-0000-0000-0000-000000000000",
    "Result": {
        "RequestId": "e1422f95-50c3-47be-9a3b-b80578412ebc",
        "ErrorMessages": [],
        "StatusMesssages": [],
        "TotalStatusMessages": 0,
        "TotalErrors": 0
    }
}
Response Values:
  • CampaignId - Campaign id information only.
  • SegmentId - Segment id information only.
  • BroadcastId - Broadcast id information only.
  • DesignIdHTML - HTML Design id information only.
  • DesignIdTXT - TXT Design id information only.
Sample Code:

    var client = new RestClient("https://localhost:44319/api/Campaign/addbroadcast/66f10516-f407-40ed-b06a-2f26ae35125b");
    client.Timeout = -1;
    var request = new RestRequest(Method.POST);
    request.AddHeader("Content-Type", "application/json");
    var body = @"{
    " + "\n" +
    @"
    " + "\n" +
    @"    ""CampaignId"": 183,
    " + "\n" +
    @"    ""SegmentId"": 8925,
    " + "\n" +
    @"    ""Subject"": ""My broadcast"",
    " + "\n" +
    @"    ""FromEmail"": {
    " + "\n" +
    @"        ""DisplayName"": ""marketing"",
    " + "\n" +
    @"        ""Email"": ""richard@sensorpXXro.net""
    " + "\n" +
    @"    },
    " + "\n" +
    @"    ""ReplyTo"": null,
    " + "\n" +
    @"    ""DesignHtmlId"": ""abdfd06b-431d-49ef-85be-bb364b7bd5c7"",
    " + "\n" +
    @"    ""DesignTxtId"": ""00000000-0000-0000-0000-000000000000"",
    " + "\n" +
    @"    ""MsgType"": 0,
    " + "\n" +
    @"    ""MailEncoding"": ""UTF8"",
    " + "\n" +
    @"    ""ExecuteBroadcast"": true,
    " + "\n" +
    @"    ""ExecuteOnUTCFormat"": null,
    " + "\n" +
    @"    ""ExtLinkId"": """"
    " + "\n" +
    @"}";
    request.AddParameter("application/json", body,  ParameterType.RequestBody);
    IRestResponse response = client.Execute(request);
    Console.WriteLine(response.Content);


    curl --location --request POST 'https://localhost:44319/api/Campaign/addbroadcast/66f10516-f407-40ed-b06a-2f26ae35125b' \
    --header 'Content-Type: application/json' \
    --data-raw '{

    "CampaignId": 183,
    "SegmentId": 8925,
    "Subject": "My broadcast",
    "FromEmail": {
    "DisplayName": "marketing",
    "Email": "richard@sensorpXXro.net"
    },
    "ReplyTo": null,
    "DesignHtmlId": "abdfd06b-431d-49ef-85be-bb364b7bd5c7",
    "DesignTxtId": "00000000-0000-0000-0000-000000000000",
    "MsgType": 0,
    "MailEncoding": "UTF8",
    "ExecuteBroadcast": true,
    "ExecuteOnUTCFormat": null,
    "ExtLinkId": ""
    }'


    OkHttpClient client = new OkHttpClient().newBuilder()
    .build();
    MediaType mediaType = MediaType.parse("application/json");
    RequestBody body = RequestBody.create(mediaType, "{\r\n \r\n    \"CampaignId\": 183,\r\n    \"SegmentId\": 8925,\r\n    \"Subject\": \"My broadcast\",\r\n    \"FromEmail\": {\r\n        \"DisplayName\": \"marketing\",\r\n        \"Email\": \"richard@sensorpXXro.net\"\r\n    },\r\n    \"ReplyTo\": null,\r\n    \"DesignHtmlId\": \"abdfd06b-431d-49ef-85be-bb364b7bd5c7\",\r\n    \"DesignTxtId\": \"00000000-0000-0000-0000-000000000000\",\r\n    \"MsgType\": 0,\r\n    \"MailEncoding\": \"UTF8\",\r\n    \"ExecuteBroadcast\": true,\r\n    \"ExecuteOnUTCFormat\": null,\r\n    \"ExtLinkId\": \"\"\r\n}");
    Request request = new Request.Builder()
    .url("https://localhost:44319/api/Campaign/addbroadcast/66f10516-f407-40ed-b06a-2f26ae35125b")
    .method("POST", body)
    .addHeader("Content-Type", "application/json")
    .build();
    Response response = client.newCall(request).execute();

GetBroadcastStatus

This call will return the current results for the selected campaign. These results will correspond to the results on the campaign dashboard.

GetBroadcastStatus Endpoint
Method: POST
https://apinie.sensorpro.net/api/Campaign/GetBroadcastStatus/[Token]

Copy to Clipboard

  • [Token] replace with the access token returned by the signin.

Simple Sample Request

{  
   "CampaignId":12
}

Input Parameters

  • CampaignID (required): ID of Campaign containing the broadcast you are looking up.

Sample Response Output

{  
   "BroadcastStatusList":[  
      {  
         "LogLink":"http://localhost:50026/Admin/Logmain.aspx?FunctionId=&LogKey1=12&LogKey2=1",
         "Status":-10,
         "Subject":"TEST API SUBJECT 1",
         "BroadcastId":1
      }
   ],
   "Result":{  
      "RequestId":"00000000-0000-0000-0000-000000000000",
      "ErrorMessages":[  

      ],
      "StatusMesssages":[  

      ],
      "TotalStatusMessages":0,
      "TotalErrors":0
   }
}



Response Values:
  • BroadcastStatusList: A collection of broadcast for this campaign and there status
  • LogLink - Link to the broadcast log
  • Status - -10 Error, 2 Queued, 10 Ready To Send, 20 Scheduled, 30 Sending, 40 Finished
  • Subject - Subject line of the broadcast
  • BroadcastId - Broadcast ID
Sample Code:

var client = new RestClient("https://apinie.sensorpro.net/api/Campaign/GetBroadcastStatus/[Token]");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("undefined", "{  \"CampaignId\":1}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);


<?php

$curl = curl_init();

curl_setopt_array($curl, array(
CURLOPT_URL => "https://apinie.sensorpro.net/api/Campaign/GetBroadcastStatus/[Token]",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{  \"CampaignId\":1}",
CURLOPT_HTTPHEADER => array(
"Content-Type: application/json"
),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
    
    

OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{  \"CampaignId\":1}");
Request request = new Request.Builder()
.url("https://apinie.sensorpro.net/api/Campaign/GetBroadcastStatus/[Token]")
.post(body)
.addHeader("Content-Type", "application/json")
.build();

Response response = client.newCall(request).execute();

GetCampaignResults

This call will return the current results for the selected campaign. These results will correspond to the results on the campaign dashboard.

Authentication Endpoint
Method: POST
https://apinie.sensorpro.net/api/campaign/GetCampaignResults/[Token]

Copy to Clipboard

  • [Token] replace with the access token returned by the signin.
Header Values
Header Example Description
Content-Type application/json  

Simple Sample Request


{  
   "CampaignId":12
}


Input Parameters

  • CampaignID (required)

Response Output


{
    "Segments": [
        {
        "CampId": 2,
        "SegmentId": 4,
        "SegmentName": "MySeedSegment",
        "Description": "API Seed Segment",
        "Status": 20,
        "SelectedTot": 0
        },
        {
        "CampId": 2,
        "SegmentId": 5,
        "SegmentName": "dd",
        "Description": "dd",
        "Status": 0,
        "SelectedTot": -1
        },
        {
        "CampId": 2,
        "SegmentId": 8,
        "SegmentName": "MySeedSegment",
        "Description": "API Seed Segment",
        "Status": 0,
        "SelectedTot": -1
        }
    ],
    "Broadcasts": [
        {
        "TriggerStatus": false,
        "TextMessage": "my text version {unsubscribe}",
        "SMSMessage": "",
        "CampId": 2,
        "BroadCastId": 1,
        "Status": -10,
        "Sent": 0,
        "Failed": 0,
        "Subject": "Test API Subject 1",
        "MessageType": 0,
        "BroadCastDate": "2018-03-02T16:37:23.19",
        "SegmentId": 4,
        "PageId": "0fb2d826-289f-40d4-a232-6c8557b2a457",
        "PageIdTxt": "00000000-0000-0000-0000-000000000000",
        "FromEmail": "test@sensorpro.net",
        "EmailEncoding": "UTF8",
        "ReplyTo": ""
        }
    ],
    "LastBroadcast": "2018-07-26T11:38:15.873",
    "CampId": 2,
    "Title": "API test",
    "CampaignOptOut": 0,
    "TotalOpenedEMail": 0,
    "TotalEMailsSent": 0,
    "TotalBounced": 0,
    "TotalImpressions": 0,
    "TotalTAF": 0,
    "TotalUnOpenedEMail": 0,
    "TotalURLUniqueOpens": 0,
    "TotalSpamPerOfSent": 0,
    "TotalOpenedEMailPerOfSent": 0,
    "TotalBouncedPerOfSent": 0,
    "CampaignOptOutPerOfSent": 0,
    "TotalURLUniqueOpensPerOfSent": 0,
    "TotalDelivered": 0,
    "PurgedCampaign": false,
    "Result": {
    "RequestId": "d7720e64-b077-4198-8265-d1cd677ff403",
    "ErrorMessages": [],
    "StatusMesssages": [],
    "TotalStatusMessages": 0,
    "TotalErrors": 0
    }
}

Response Details
Type Field Description
Object Segments List of segments used in the campaign
Object Broadcast List of broadcasts used in the campaign
long CampaignOptOut Optout Count
long TotalOpenedEMail Count of uniquely opened emails
long TotalEMailsSent Count of emails sent
long TotalBounced Count of bounced emails
long TotalImpressions Count of impressions
long TotalTAF Refer a friend count
long TotalUnOpenedEMail Unopened email count
long TotalURLUniqueOpens URL click through count
long TotalSpamReports Spam count
decimal TotalSpamPerOfSent Spam reports as percent of sent
decimal TotalOpenedEMailPerOfSent Opens as percent of sent emails
decimal TotalBouncedPerOfSent Bounced as percent of sent emails
decimal CampaignOptOutPerOfSent Opt outs as percent of sent
decimal TotalURLUniqueOpensPerOfSent Link Clicks as percent of sent
bool TotalSpamPerOfSent Spam reports as percent of sent
decimal PurgedCampaign Is campaign purged
Sample Code:

    var client = new RestClient("https://apinie.sensorpro.net/api/campaign/GetCampaignResults/[Token]");
    var request = new RestRequest(Method.POST);
    request.AddHeader("Content-Type", "application/json");
    request.AddParameter("undefined", "{  \"CampaignId\":2}", ParameterType.RequestBody);
    IRestResponse response = client.Execute(request);


    <?php
    $curl = curl_init();
    curl_setopt_array($curl, array(
    CURLOPT_URL => "https://apinie.sensorpro.net/api/campaign/GetCampaignResults/[Token]",
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_ENCODING => "",
        CURLOPT_MAXREDIRS => 10,
        CURLOPT_TIMEOUT => 30,
        CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
        CURLOPT_CUSTOMREQUEST => "POST",
        CURLOPT_POSTFIELDS => "{  \"CampaignId\":2}",
        CURLOPT_HTTPHEADER => array(
        "Content-Type: application/json"
        ),
    ));

    $response = curl_exec($curl);
    $err = curl_error($curl);

    curl_close($curl);

    if ($err) {
    echo "cURL Error #:" . $err;
    } else {
    echo $response;
    }


    OkHttpClient client = new OkHttpClient();

    MediaType mediaType = MediaType.parse("application/json");
    RequestBody body = RequestBody.create(mediaType, "{  \"CampaignId\":2}");
    Request request = new Request.Builder()
    .url("https://apinie.sensorpro.net/api/campaign/GetCampaignResults/[Token]")
    .post(body)
    .addHeader("Content-Type", "application/json")
    .build();

    Response response = client.newCall(request).execute();

TriggerEmail

Trigger an email for a contact, the contact will be added if it does not exist. This function requires a triggered email campaign to be setup in advance. This API call is asynchronous and the trigger request is queued thus the API call returns immediately.

TriggerEmail Endpoint
Method: POST
https://apinie.sensorpro.net/api/Campaign/TriggerEmail/[Token]

Copy to Clipboard

  • [Token] replace with the access token returned by the signin.
Header Values
Header Example Description
Content-Type application/json  

Simple Sample Request


{
    "CampId":"9e06ba0c-1ce1-48c9-80a8-154ce9403fd0",
    "BroadcastId":1,
    "Delay":0,
    "ContactData":{
        "Title":"",
        "FirstName":"John",
        "LastName":"Smith",
        "PersonalEMail":"johnsmithy@acme.com"
    },
    "NamedPairsParameters":{
        "Invoice":"IV00101120"
    }
}

Key Input Parameters

  • CampId: required, this can be got from the triggered email campaign
  • BroadcastId: required, the broadcast which will be sent
  • Delay: optional, delay in minutes before email is sent
  • ContactData: required, minimum value is “personalemail”
  • NamedParameters: optional, allow you to pass data through to the email design. For example, if you have an invoice number which you want to pass through to the email design, you could create a named pair parameter called “Invoice”. This can be referenced on the email design with {Invoice} - the value will be substituted in as the email is sent out. Note: emails which use named parameters should not include a view in browser link. As the data being passed forward is transient, it will not be available after the email is sent.
  • PhoneMobile: required if sending SMS messages, not required if sending email
  • See UpdateAdd Contact API Call for full list of contact fields which can be used in "ContactData". This sample show the most common fields which are used.

Response Output


{
    "Result": {
    "RequestId": "0c5bf11d-2bd5-4afe-8702-ae0ecf5d66ad",
    "ErrorMessages": [],
    "StatusMesssages": [
    {
    "Code": "RequestQueued",
    "Description": "Request queued with request ID 8b2174eb-d191-445c-9738-ac8d14de3b3c",
    "Sequence": 0
    }
    ],
    "TotalStatusMessages": 1,
    "TotalErrors": 0
    }
}


Response Values:
  • RequestId - The request id of the submitted triggered email. This can be checked through the ui menu Admin > Setup > API > API > Triggered Email Queue
Sample Code:

var client = new RestClient("https://apinie.sensorpro.net/api/Campaign/TriggerEmail/[Token]");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("undefined", "{  \"CampId\":\"9e06ba0c-1ce1-48c9-80a8-154ce9403fd0\",\"BroadcastId\":1,\"Delay\":0,\"ContactData\":{\"Title\":\"\", \"FirstName\":\"John\", \"LastName\":\"Smith\", \"PersonalEMail\":\"rcoa.dy@gmail.com\"},\"NamedPairsParameters\":{\"Invoice\":\"IV00101120\", \"Body\":\"Test Content\"}}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);


<?php

$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => "https://apinie.sensorpro.net/api/Campaign/TriggerEmail/[Token]",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POSTFIELDS => "{  \"CampId\":\"9e06ba0c-1ce1-48c9-80a8-154ce9403fd0\",\"BroadcastId\":1,\"Delay\":0,\"ContactData\":{\"Title\":\"\", \"FirstName\":\"John\", \"LastName\":\"Smith\", \"PersonalEMail\":\"rcoa.dy@gmail.com\"},\"NamedPairsParameters\":{\"Invoice\":\"IV00101120\", \"Body\":\"Test Content\"}}",
    CURLOPT_HTTPHEADER => array(
    "Content-Type: application/json"
),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
    

OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{  \"CampId\":\"9e06ba0c-1ce1-48c9-80a8-154ce9403fd0\",\"BroadcastId\":1,\"Delay\":0,\"ContactData\":{\"Title\":\"\", \"FirstName\":\"John\", \"LastName\":\"Smith\", \"PersonalEMail\":\"rcoa.dy@gmail.com\"},\"NamedPairsParameters\":{\"Invoice\":\"IV00101120\", \"Body\":\"Test Content\"}}");
Request request = new Request.Builder()
.url("https://apinie.sensorpro.net/api/Campaign/TriggerEmail/[Token]")
.post(body)
.addHeader("Content-Type", "application/json")
.build();

Response response = client.newCall(request).execute();

GetMetricsFromQueue

This API will retrieve metrics which have been queued for export. That means that Export integration must be active. When integration is active metric clicks are queued in a file waiting to be picked up by this API call. To enable, select Admin | Setup | System Settings; on "FTP/ODBC" tab select "Integration Active". As metrics come in, records will be written to the export queue.

Authentication Endpoint
Method: POST
https://apinie.sensorpro.net/api/Campaign/GetMetricsFromQueue/[Token]

Copy to Clipboard

  • [Token] replace with the access token returned by the signin.
Header Values
Header Example Description
Content-Type application/json  

Simple Sample Request


{
    "Paging": {
        "Page": 1,
        "PageSize": 1,
        "Options": {
        "Parameters": {},
        "Action": ""
    },
    "Fields": []
    },
    "MetricType": 40
}

Key Input Parameters

  • GetMetrics (Object)
    • Paging: optional ID to link campaign to your system.
      • Page: This api call returns the data a page at a time. This indicates which page to get. If paging through the complete data set increate the page count by one until no more data is returned.
      • PageSize: This indicates how many contacts to return at a time.
      • Fields: This is not applicable for this API call.
    • MetricType:
      • -2 Open email metric
      • 0 Microsite click
      • 60 URL click
      • 40 Unsubscribe and opt back in
      • 70 Bounce emails and un-bounce emails
      • 170 Category unsubscribe and category opt back in
      • 230 SMS unsubscribe and opt back in
{ 
- "MetricResults": [1]
	-0:  {
		-"contactData": { ... }
		"Subject": "Test Subject Line"
		"URL": ""
		"BroadcastId": "na"
		"Date": "2018-04-01"
		"MessageID": "19"
		"MetricType": "OpenEmail"
	}
	- "Result": {
		"RequestID": "9e123654-46f4-232a-441f-f324e3433a9812"
		"ErrorMessages": [0]
		"StatusMesssages": [0]
		"TotalStatusMessages": 0
		"TotalErrors": 0
	}
}

Response Output

  • Array of metric results containing:
    • ContactData: Contains the contact record which the metric applies to. Only the fields will be populated which were passed forward in the request.
    • Subject: Email subject line
    • URL: Will be populated only if metric clicked
    • Date: Date the metric was registered
    • MessageId: Message ID
    • Metric Type: Contains the following:
      • OpenEmail: open email metric
      • UrlClick: URL click
      • OptBackIn: email opt back in
      • OptOut: email opt out
      • Bounced: bounced email
      • Active: email un-bounced
      • CatOptIn: category opt in
      • CatOptOut: category optout
      • SMSOptOut: SMS opt out
      • SMSOptBackIn: SMS opt back in
      • ClickToMicroSite: Click to microsite
Note: Once the export metric is retrieved it cannot be gotten again. It is marked as completed.
Sample Code:

var client = new RestClient("https://apinie.sensorpro.net/api/Campaign/GetMetricsFromQueue/[Token]");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("undefined", "{ \"Paging\": {   \"Page\": 1,   \"PageSize\": 1,   \"Options\": {   \"Parameters\": {},   \"Action\": \"\" }, \"Fields\": [] }, \"MetricType\": 40}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);


<?php

$curl = curl_init();

curl_setopt_array($curl, array(
CURLOPT_URL => "https://apinie.sensorpro.net/api/Campaign/GetMetricsFromQueue/[Token]",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POSTFIELDS => "{ \"Paging\": {   \"Page\": 1,   \"PageSize\": 1,   \"Options\": {   \"Parameters\": {},   \"Action\": \"\" }, \"Fields\": [] }, \"MetricType\": 40}",
    CURLOPT_HTTPHEADER => array(
    "Content-Type: application/json"
    ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}


OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{ \"Paging\": {   \"Page\": 1,   \"PageSize\": 1,   \"Options\": {   \"Parameters\": {},   \"Action\": \"\" }, \"Fields\": [] }, \"MetricType\": 40}");
Request request = new Request.Builder()
.url("https://apinie.sensorpro.net/api/Campaign/GetMetricsFromQueue/[Token]")
.post(body)
.addHeader("Content-Type", "application/json")
.build();

Response response = client.newCall(request).execute();

GetCampaignByLastBroadcastDate

This API will retrieve a list of campaigns selected by last broadcast date.

Authentication Endpoint
Method: POST
https://apinie.sensorpro.net/api/Campaign/GetCampaignByLastBroadcastDate/[Token]

Copy to Clipboard

  • [Token] replace with the access token returned by the signin.
Header Values
Header Example Description
Content-Type application/json  

Simple Sample Request


    {
    "ListName": "",
    "FromDate": "2021-08-04",
    "ToDate": "2021-11-04"
    }


Key Input Parameters

  • Required
  • FromDate: The "From" date (required)
  • ToDate: The "To" date (required)
  • Optional
  • ListName: The name of the list (optional).

Response Output

Array of campaigns containing the following structure:

"CAMPAIGNLIST": [
        {
            "CAMPID": 2112,
            "TITLE": "JULY SALE",
            "MANAGER": "RICHARD SMITH",
            "STARTDATE": "2018-05-04T00:00:00",
            "ENDDATE": "2018-07-04T00:00:00",
            "EXTCAMPAIGN": "",
            "TOTALSENT": 4,
            "EXTERNALID": "B41E360B-F042-4CC8-A355-1ABAB8872BA8",
            "FROMEMAIL": {
                "DISPLAYNAME": "MARKETING",
                "USER": "MARKETING",
                "HOST": "SENSORPRO.NET",
                "ADDRESS": "MARKETING@SENSORPRO.NET"
            },
            "REPLYTOEMAIL": NULL,
            "SUBJECT": "UP TO 50% OFF SALE ON SELECTED ITEMS",
            "LASTBROADCAST": "2018-05-08T15:36:23.643",
            "LISTNAME": "2018-05-05T15:36:23.643"
        }
    ],
    "RESULT": {
        "REQUESTID": "B71D3A98-D425-4071-97B6-054D8DFBF930",
        "ERRORMESSAGES": [],
        "STATUSMESSSAGES": [],
        "TOTALSTATUSMESSAGES": 0,
        "TOTALERRORS": 0
    }
}



Sample Code:

var client = new RestClient("https://apinie.sensorpro.net/api/Campaign/GetCampaignByLastBroadcastDate/[Token]");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("undefined", "{\t\"FROMDATE\":\"2018-05-01\",\t\"TODATE\":\"2018-07-01\", \"LISTNAME\":\"\"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);


<?php

$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => "https://apinie.sensorpro.net/api/Campaign/GetCampaignByLastBroadcastDate/[Token]",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POSTFIELDS => "{\t\"FROMDATE\":\"2018-05-01\",\t\"TODATE\":\"2018-07-01\", \"LISTNAME\":\"\"}",
    CURLOPT_HTTPHEADER => array(
    "Content-Type: application/json"
    ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}


OkHttpClient client = new OkHttpClient();

MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\t\"FROMDATE\":\"2018-05-01\",\t\"TODATE\":\"2018-07-01\", \"LISTNAME\":\"\"}");
Request request = new Request.Builder()
.url("https://apinie.sensorpro.net/api/Campaign/GetCampaignByLastBroadcastDate/[Token]")
.post(body)
.addHeader("Content-Type", "application/json")
.build();

Response response = client.newCall(request).execute();