366 Degrees

366 Web API

Get Status of Open Drip Campaigns

Description:This will return contact status of an open drip campaign in 366 Degrees.
Method: GetContactStatus
URL:https://api.366.io/DripCampaignApis/api/ContactStatus
 

Try it out

Campaigns Status Information

 
Asset Name ScheduledDate WorkflowStep Schedulestatus
 

Sample Code

MVC Code

[HttpPost]
public ActionResult GetContactStatus(Campaign cam)
{
var result = string.Empty;
var finalresult = string.Empty;
dynamic json;
try
{
var postReq = (HttpWebRequest)WebRequest.Create(ConfigurationManager.AppSettings["ContactStatus"].ToString());
postReq.Method = "GET";
postReq.ContentType = "application/x-www-form-urlencoded;charset=utf-8";
postReq.Headers.Add("Authorization", cam.Authorization);
postReq.Headers.Add("CampaignId", cam.CampaignId);
postReq.Headers.Add("UserId", cam.EmailId);
var httpWebReponse = (HttpWebResponse)postReq.GetResponse();
StreamReader responseReader = new StreamReader(httpWebReponse.GetResponseStream());
result = responseReader.ReadToEnd();
httpWebReponse.Close();
responseReader.Close();
finalresult = JsonConvert.SerializeObject(result);
json = JsonConvert.DeserializeObject(finalresult);
}
catch (Exception ex)
{
throw ex;
}
return Json(json, JsonRequestBehavior.AllowGet);
}

JQuery Code

$('#Dripsubmit').click(function ()
{
var form = $("form");
form.validate();
if (form.valid() && !window.isSubmitted)
{
window.isSubmitted = true;
var cam = {
Authorization: $("#Authorization").val(),
CampaignId: $("#CampaignId").val(),
EmailId: $("#EmailId").val()
};
$.ajax({
url: "/OpenDripCampaign/GetContactStatus",
type: "POST",
contentType: "application/json;charset=utf-8",
data: JSON.stringify(cam),
dataType: 'json',
timeout: 1200000,
async: true,
success: function (data) {
var myresult = $.parseJSON(data);
var finalData = JSON.parse(myresult);
alert(finalData[0].customerstatus);
$("#tbldetails,#tblStatus").append("" + finalData[0].Title + "" + finalData[0].ScheduledDate + "" + finalData[0].WorkflowStep + "" + finalData[0].Schedulestatus + " ");
},
error: function(err)
{
window.isSubmitted = false;
displaySwalMessageWithButton("Please resolve all errors to proceed further.", "Warning");
console.log(err);
}
});
}
});

Json Output Sample

{
Asset Name : "Drip Campaign Open Route Asset",
Scheduled Date: "08-03-2018",
WorkflowStep : "1 of 4",
Schedulestatus:"Removed From Campaign"
}