public static BaseReply InvokeEM28AppsTechnologySharedWithAFriend(InvokeEM28AppsTechnologySharedWithAFriendRequest request) { BaseReply reply = new BaseReply(); SoapClient client = ExactTargetService.GetInstance(); StringBuilder sbReturnString = new StringBuilder(); Guid preferredLanguage = request.PreferredLanguage; int emailTemplateID = GetEmailTemplateId(preferredLanguage, Constants.EmailIDs.EM28AppsTechnologySharedWithAFriendENID, Constants.EmailIDs.EM28AppsTechnologySharedWithAFriendSPID); try { //Create a GUID for ESD to ensure a unique name and customer key TriggeredSendDefinition tsd = ExactTargetService.GetSendDefinition(Guid.NewGuid().ToString(), emailTemplateID, request.ToEmail, "apps technology shared with friend"); string cStatus = ExactTargetService.GetCreateResult(ref client, tsd, ref sbReturnString); if (cStatus == "OK") { tsd.TriggeredSendStatus = TriggeredSendStatusEnum.Active; //necessary to set the TriggeredSendDefinition to "Running" tsd.TriggeredSendStatusSpecified = true; //required string uStatus = ExactTargetService.GetUpdateResult(ref client, tsd, ref sbReturnString); if (uStatus == "OK") { // *** SEND THE TRIGGER EMAIL Subscriber newSub = new Subscriber(); newSub.EmailAddress = request.ToEmail; newSub.SubscriberKey = request.ToEmail; etAPI.Attribute tempAttribute; List<etAPI.Attribute> AttributeList = new List<etAPI.Attribute>(); tempAttribute = new etAPI.Attribute(); tempAttribute.Name = "domain_link"; tempAttribute.Value = request.RequestUrl.Scheme + "://" + request.RequestUrl.Authority; AttributeList.Add(tempAttribute); tempAttribute = new etAPI.Attribute(); tempAttribute.Name = "app_description"; tempAttribute.Value = request.AppDescription; AttributeList.Add(tempAttribute); tempAttribute = new etAPI.Attribute(); tempAttribute.Name = "app_good_for"; tempAttribute.Value = request.AppGoodFor; AttributeList.Add(tempAttribute); tempAttribute = new etAPI.Attribute(); tempAttribute.Name = "app_grade"; tempAttribute.Value = request.AppGrade; AttributeList.Add(tempAttribute); tempAttribute = new etAPI.Attribute(); tempAttribute.Name = "app_learning_link"; tempAttribute.Value = request.AppLearningLink; AttributeList.Add(tempAttribute); tempAttribute = new etAPI.Attribute(); tempAttribute.Name = "app_link"; tempAttribute.Value = request.AppLink; AttributeList.Add(tempAttribute); tempAttribute = new etAPI.Attribute(); tempAttribute.Name = "app_logo"; tempAttribute.Value = request.AppLogo; AttributeList.Add(tempAttribute); tempAttribute = new etAPI.Attribute(); tempAttribute.Name = "app_quality"; tempAttribute.Value = request.AppQuality; AttributeList.Add(tempAttribute); tempAttribute = new etAPI.Attribute(); tempAttribute.Name = "app_rating_link"; tempAttribute.Value = request.AppRatingLink; AttributeList.Add(tempAttribute); tempAttribute = new etAPI.Attribute(); tempAttribute.Name = "app_rating_module"; tempAttribute.Value = request.AppRatingModule; AttributeList.Add(tempAttribute); tempAttribute = new etAPI.Attribute(); tempAttribute.Name = "app_title"; tempAttribute.Value = request.AppTitle; AttributeList.Add(tempAttribute); tempAttribute = new etAPI.Attribute(); tempAttribute.Name = "user_contact_first_name"; tempAttribute.Value = request.UserContactFirstName; AttributeList.Add(tempAttribute); newSub.Attributes = AttributeList.ToArray(); ExactTargetService.SendEmail(ref client, tsd, ref sbReturnString, newSub); reply.Successful = true; } } } catch (Exception exc) { string message = "Unable to send welcome email."; reply.Successful = false; reply.Message = message; Log.Error(exc.ToString(), "something went wrong"); } return reply; }
public static BaseReply InvokeEM7NewsletterConfirmation(InvokeEM7NewsletterConfirmationRequest request) { BaseReply reply = new BaseReply(); SoapClient client = ExactTargetService.GetInstance(); StringBuilder sbReturnString = new StringBuilder(); Guid preferredLanguage = request.PreferredLanguage; int emailTemplateID = GetEmailTemplateId(preferredLanguage, Constants.EmailIDs.EM7NewsletterConfirmationENID, Constants.EmailIDs.EM7NewsletterConfirmationSPID); try { //Create a GUID for ESD to ensure a unique name and customer key TriggeredSendDefinition tsd = ExactTargetService.GetSendDefinition(Guid.NewGuid().ToString(), emailTemplateID, request.ToEmail, "Newsletter Confirmation"); string cStatus = ExactTargetService.GetCreateResult(ref client, tsd, ref sbReturnString); if (cStatus == "OK") { tsd.TriggeredSendStatus = TriggeredSendStatusEnum.Active; //necessary to set the TriggeredSendDefinition to "Running" tsd.TriggeredSendStatusSpecified = true; //required string uStatus = ExactTargetService.GetUpdateResult(ref client, tsd, ref sbReturnString); if (uStatus == "OK") { // *** SEND THE TRIGGER EMAIL Subscriber newSub = new Subscriber(); newSub.EmailAddress = request.ToEmail; newSub.SubscriberKey = request.ToEmail; etAPI.Attribute tempAttribute; List<etAPI.Attribute> AttributeList = new List<etAPI.Attribute>(); tempAttribute = new etAPI.Attribute(); tempAttribute.Name = "week_day"; tempAttribute.Value = request.WeekDay; AttributeList.Add(tempAttribute); tempAttribute = new etAPI.Attribute(); tempAttribute.Name = "confirm_subscription_link"; tempAttribute.Value = request.WeekDay; AttributeList.Add(tempAttribute); tempAttribute = new etAPI.Attribute(); tempAttribute.Name = "domain_link"; tempAttribute.Value = request.RequestUrl.Scheme + "://" + request.RequestUrl.Authority; AttributeList.Add(tempAttribute); newSub.Attributes = AttributeList.ToArray(); ExactTargetService.SendEmail(ref client, tsd, ref sbReturnString, newSub); reply.Successful = true; } } } catch (Exception exc) { string message = "Unable to send welcome email."; reply.Successful = false; reply.Message = message; Log.Error(exc.ToString(), "something went wrong"); } return reply; }
public static BaseReply InvokeEM24ContentSharedWithAFriend(InvokeEM24ContentSharedWithAFriendRequest request) { BaseReply reply = new BaseReply(); SoapClient client = ExactTargetService.GetInstance(); StringBuilder sbReturnString = new StringBuilder(); Guid preferredLanguage = request.PreferredLanguage; int emailTemplateID = GetEmailTemplateId(preferredLanguage, Constants.EmailIDs.EM24ContentSharedWithAFriendENID, Constants.EmailIDs.EM24ContentSharedWithAFriendSPID); try { //Create a GUID for ESD to ensure a unique name and customer key TriggeredSendDefinition tsd = ExactTargetService.GetSendDefinition(Guid.NewGuid().ToString(), emailTemplateID, request.ToEmail, "content shared with a friend"); string cStatus = ExactTargetService.GetCreateResult(ref client, tsd, ref sbReturnString); if (cStatus == "OK") { tsd.TriggeredSendStatus = TriggeredSendStatusEnum.Active; //necessary to set the TriggeredSendDefinition to "Running" tsd.TriggeredSendStatusSpecified = true; //required string uStatus = ExactTargetService.GetUpdateResult(ref client, tsd, ref sbReturnString); if (uStatus == "OK") { // *** SEND THE TRIGGER EMAIL Subscriber newSub = new Subscriber(); newSub.EmailAddress = request.ToEmail; newSub.SubscriberKey = request.ToEmail; etAPI.Attribute tempAttribute; List<etAPI.Attribute> AttributeList = new List<etAPI.Attribute>(); tempAttribute = new etAPI.Attribute(); tempAttribute.Name = "domain_link"; tempAttribute.Value = request.RequestUrl.Scheme + "://" + request.RequestUrl.Authority; AttributeList.Add(tempAttribute); tempAttribute = new etAPI.Attribute(); tempAttribute.Name = "content_helpfulness_and_comments_module"; tempAttribute.Value = request.ContentHelpfulnessAndCommentsModule; AttributeList.Add(tempAttribute); tempAttribute = new etAPI.Attribute(); tempAttribute.Name = "pm_text"; tempAttribute.Value = request.PMText; AttributeList.Add(tempAttribute); tempAttribute = new etAPI.Attribute(); tempAttribute.Name = "reminder_image"; tempAttribute.Value = request.ReminderImage; AttributeList.Add(tempAttribute); tempAttribute = new etAPI.Attribute(); tempAttribute.Name = "reminder_link"; tempAttribute.Value = request.ReminderLink; AttributeList.Add(tempAttribute); tempAttribute = new etAPI.Attribute(); tempAttribute.Name = "reminder_summary"; tempAttribute.Value = request.ReminderSummary; AttributeList.Add(tempAttribute); tempAttribute = new etAPI.Attribute(); tempAttribute.Name = "reminder_title"; tempAttribute.Value = request.ReminderTitle; AttributeList.Add(tempAttribute); tempAttribute = new etAPI.Attribute(); tempAttribute.Name = "user_contact_first_name"; tempAttribute.Value = request.UserContactFirstName; AttributeList.Add(tempAttribute); newSub.Attributes = AttributeList.ToArray(); ExactTargetService.SendEmail(ref client, tsd, ref sbReturnString, newSub); reply.Successful = true; } } } catch (Exception exc) { string message = "Unable to send welcome email."; reply.Successful = false; reply.Message = message; Log.Error(exc.ToString(), "something went wrong"); } return reply; }