Example #1
0
        public IHttpActionResult AddBulksendRequest(BulksendRequestViewModel bulksendRequestViewModel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            bulksendRequestViewModel.BulksendRequestId         = 1;
            bulksendRequestViewModel.EmailSendScheduleDatetime = DateTime.Now;

            var fileRequest = new FileRequest()
            {
                BatchId                          = bulksendRequestViewModel.BatchId,
                BulkSendId                       = bulksendRequestViewModel.BulksendId,
                ContentId                        = bulksendRequestViewModel.EmailContentId,
                FilePath                         = System.Web.Hosting.HostingEnvironment.MapPath("~/datafiles/") + bulksendRequestViewModel.BulksendInputDataFile,
                TenantAccountId                  = bulksendRequestViewModel.TenantAccountId,
                BulkSendEmailType                = bulksendRequestViewModel.EmailClassification ? BulkSendEmailType.Promotional : BulkSendEmailType.Transactional,
                IsSendInvoke                     = bulksendRequestViewModel.IsEmailSendInvoke,
                IsDynamicDataExtension           = bulksendRequestViewModel.BulksendApproach,
                IsOverrideConfiguration          = true,
                DataImportType                   = bulksendRequestViewModel.DataImportType ? DataImportType.Overwrite : DataImportType.AddAndUpdate,
                DynamicDataExtensionTemplateName = bulksendRequestViewModel.DataExtensionTemplateName
            };

            var azureTBNClient = new AzureTBNClientSDK.InterchangeConnect();
            var filesendResult = azureTBNClient.SendFileRequest(fileRequest);

            return(CreatedAtRoute("EiRequestsApi", null, filesendResult));
        }
        /// <summary>
        /// EmailTracking: Get BulkSend Summary Version 2
        ///     - NumberTargeted
        ///     - NumberDelivered
        ///     - NumberErrored
        ///     - UniqueClicks
        ///     - UniqueOpens
        ///     - Unsubscribes, etc.,
        ///     - EIRequestId
        /// </summary>
        /// <returns></returns>
        private static string GetEmailTrackingBulkSendSummaryDataV2()
        {
            System.Guid requestID;
            AzureTBNClientSDK.InterchangeConnect client = new AzureTBNClientSDK.InterchangeConnect();

            EmailTrackingOutputOfBulkSendSummaryDetails bulkSummary;
            //Construct Email Tracking Bulk send Summary input object.
            EmailTrackingInputOfBulkSendSummaryInput inputBulkSummary = new EmailTrackingInputOfBulkSendSummaryInput
            {
                EmailTrackingCriteria = new BulkSendSummaryInput
                {
                    //Assign Client ID
                    ClientId = 39327,
                    //Assign Batch Id.
                    TenantBatchID = "6B08CBB1-2B44-4B45-A937-4AE1479C2302",
                    //Assign Bulk Send Id
                    TenantBulkSendId = "6B08CBB1-2B42-4B45-A938-4AE1479C2342"
                }
            };

            //Retrieve call.
            bulkSummary = client.GetEmailTrackingSummaryData <EmailTrackingInputOfBulkSendSummaryInput, EmailTrackingOutputOfBulkSendSummaryDetails>(inputBulkSummary, out requestID);

            return(StringResources.EMAIL_TRACKING_BULK_SEND_SUMMARY_STATUS + "EI ID: " + requestID.ToString());
        }
        /// <summary>
        /// EmailTracking: Get BulkSend Summary
        ///     - NumberTargeted
        ///     - NumberDelivered
        ///     - NumberErrored
        ///     - UniqueClicks
        ///     - UniqueOpens
        ///     - Unsubscribes, etc.,
        /// </summary>
        /// <returns></returns>
        private static string GetEmailTrackingBulkSendSummaryData()
        {
            AzureTBNClientSDK.InterchangeConnect        client = new AzureTBNClientSDK.InterchangeConnect();
            EmailTrackingOutputOfBulkSendSummaryDetails bulkSummary;

            //Construct Email Tracking Bulk send Summary input object.
            EmailTrackingInputOfBulkSendSummaryInput inputBulkSummary = new EmailTrackingInputOfBulkSendSummaryInput
            {
                EmailTrackingCriteria = new BulkSendSummaryInput
                {
                    //Assign Client ID
                    ClientId = 10460681,
                    //Assign Batch Id.
                    TenantBatchID = "1004",
                    //Assign Bulk Send Id
                    TenantBulkSendId = "1"
                }
            };

            //Retrieve call.
            bulkSummary = client.GetEmailTrackingSummaryData <EmailTrackingInputOfBulkSendSummaryInput, EmailTrackingOutputOfBulkSendSummaryDetails>(inputBulkSummary);
            Console.WriteLine(bulkSummary.EmailTrackingResult);

            return(StringResources.EMAIL_TRACKING_BULK_SEND_SUMMARY_STATUS);
        }
Example #4
0
        /// <summary>
        /// EmailTracking: Get BulkSend Summary Version 2
        ///     - NumberTargeted
        ///     - NumberDelivered
        ///     - NumberErrored
        ///     - UniqueClicks
        ///     - UniqueOpens
        ///     - Unsubscribes, etc.,
        ///     - EIRequestId
        /// </summary>
        /// <returns></returns>
        private static string GetEmailTrackingBulkSendSummaryDataV2()
        {
            System.Guid requestID;
            AzureTBNClientSDK.InterchangeConnect client = new AzureTBNClientSDK.InterchangeConnect();

            EmailTrackingOutputOfBulkSendSummaryDetails bulkSummary;
            //Construct Email Tracking Bulk send Summary input object.
            EmailTrackingInputOfBulkSendSummaryInput inputBulkSummary = new EmailTrackingInputOfBulkSendSummaryInput
            {
                EmailTrackingCriteria = new BulkSendSummaryInput
                {
                    //Assign Client ID
                    ClientId = 39327,
                    //Assign Batch Id.
                    TenantBatchID = "64377d77-d0eb-451b-93a0-93e10953f5ba",
                    //Assign Bulk Send Id
                    TenantBulkSendId = "b480ee7d-2444-4f37-ba6d-db279b87b60d"
                }
            };

            //Retrieve call.
            bulkSummary = client.GetEmailTrackingSummaryData <EmailTrackingInputOfBulkSendSummaryInput, EmailTrackingOutputOfBulkSendSummaryDetails>(inputBulkSummary, out requestID);

            return(StringResources.EMAIL_TRACKING_BULK_SEND_SUMMARY_STATUS + "EI ID: " + requestID.ToString());
        }
        private static string CallRequestStatus(System.Guid emailInterchangeId, AzureServiceReference.RequestTypeForEnhancedAPI requestType)
        {
            var interchangerequeststatus = new InterchangeRequestStatus();

            /*Instantiating the Proxy Class*/
            AzureTBNClientSDK.InterchangeConnect client = new AzureTBNClientSDK.InterchangeConnect();
            interchangerequeststatus = client.GetRequestStatus(emailInterchangeId, requestType);
            return(string.Format(StringResources.REQUEST_STATUS_MESSAGE, emailInterchangeId + Convert.ToString(interchangerequeststatus.RequestStatusMessage)));
        }
Example #6
0
        private static string Create_TBN_Generic_Against_EI_API(string emailAddress, string body01, string body02)
        {
            var newSubscriber = new GenericSubscriber();

            newSubscriber.EmailAddress = emailAddress;

            // addition of custom attributes
            newSubscriber.Attributes = new AzureTBNClientSDK.AzureServiceReference.Attribute[2];
            var attribute = new AzureTBNClientSDK.AzureServiceReference.Attribute();

            attribute.Name              = "Param001";
            attribute.Value             = body01;
            newSubscriber.Attributes[0] = attribute;

            attribute                   = new AzureTBNClientSDK.AzureServiceReference.Attribute();
            attribute.Name              = "Param002";
            attribute.Value             = body02;
            newSubscriber.Attributes[1] = attribute;

            /* Creating a new request*/
            TriggeredRequestBase request = new TriggeredRequestBase();

            request.ApplicationName = "Generic";
            request.CustomerKey     = "AAD_Dashboard_Triggered_Send_001";

            request.DeliveryType      = EmailType.Html;
            request.TriggerDataSource = TriggerDataSource.None;
            request.TriggerType       = TriggeredSendType.NoDelay;

            request.Subscribers = new GenericSubscriber[1];
            // NOTE : the above can be changed to any other type of collection
            // by configuring the service reference to use
            // other collection types like List, Collection, ArrayList, etc
            request.Subscribers[0] = newSubscriber;

            EmailInterchangeResult results = EmailInterchangeResult.None;

            /*Instantiating the Proxy Class*/
            AzureTBNClientSDK.InterchangeConnect client = new AzureTBNClientSDK.InterchangeConnect();
            results = client.Send(request);

            return(results.ToString());
        }
        /// <summary>
        /// EmailTracking: GetStatus
        /// </summary>
        /// <returns></returns>
        private static string GetEmailTrackingStatusData()
        {
            AzureTBNClientSDK.InterchangeConnect client = new AzureTBNClientSDK.InterchangeConnect();

            //EmailTrackingOutput type.
            EmailTrackingOutputOfEmilTrackingOutputDetails emailTracking;
            //Construct EmailTracking Input type.
            EmailTrackingInputOfEmailTrackingInputCriteria objStatusInput = new EmailTrackingInputOfEmailTrackingInputCriteria
            {
                EmailTrackingCriteria = new EmailTrackingInputCriteria
                {
                    ClientID            = 10460681,
                    TenantSubscriberKey = "9afcee23-2b03-4a00-b8b0-7ef7188c8379",
                    TenantTrackingField = "9afcee23-2b03-4a00-b8b0-7ef7188c8379"
                }
            };

            //Retrieve call.
            emailTracking = client.GetEmailTrackingStatusData(objStatusInput);
            return(StringResources.EMAIL_TRACKING_STATUS);
        }
Example #8
0
        /// <summary>
        /// EmailTracking: GetStatus
        /// </summary>
        /// <returns></returns>
        private static string GetEmailTrackingStatusData()
        {
            AzureTBNClientSDK.InterchangeConnect client = new AzureTBNClientSDK.InterchangeConnect();

            //EmailTrackingOutput type.
            EmailTrackingOutputOfEmilTrackingOutputDetails emailTracking;
            //Construct EmailTracking Input type.
            EmailTrackingInputOfEmailTrackingInputCriteria objStatusInput = new EmailTrackingInputOfEmailTrackingInputCriteria
            {
                EmailTrackingCriteria = new EmailTrackingInputCriteria
                {
                    ClientID            = 39327,
                    TenantSubscriberKey = "e084362d-6e61-4ef3-9a97-92eaf7365ff1",
                    TenantTrackingField = "e084362d-6e61-4ef3-9a97-92eaf7365fe3"
                }
            };

            //Retrieve call.
            emailTracking = client.GetEmailTrackingStatusData(objStatusInput);
            return(StringResources.EMAIL_TRACKING_STATUS);
        }
        /// <summary>
        /// Test Method for BulkSend
        /// </summary>
        /// <returns></returns>
        private static string BulkSend()
        {
            var fileRequest = new FileRequest()
            {
                BatchId                          = "1008",
                BulkSendId                       = "1",
                ContentId                        = 312182,
                FilePath                         = @"D:\Usr\Krishna\EI_HCP_Team_Input_File_003.tsv",
                TenantAccountId                  = "10460681",
                BulkSendEmailType                = BulkSendEmailType.Promotional,
                IsSendInvoke                     = true,
                IsDynamicDataExtension           = true,
                IsOverrideConfiguration          = true,
                DataImportType                   = DataImportType.Overwrite,
                DynamicDataExtensionTemplateName = "ITPROTEMPLATEv2"
            };

            var azureTBNClient = new AzureTBNClientSDK.InterchangeConnect();
            var filesendResult = azureTBNClient.SendFileRequest(fileRequest);

            return(filesendResult.Result + "; EI ID: '" + filesendResult.EmailInterchangeId + "'");
        }
Example #10
0
        private static bool SendTriggeredWelcomeEmail(string address)
        {
            if (address == null)
            {
                return(false);
            }

            // Create the subscriber
            GenericSubscriber newSubscriber = new GenericSubscriber();

            newSubscriber.EmailAddress = address;
            // Create the request
            TriggeredRequestBase request = new TriggeredRequestBase();

            request.ApplicationName   = "ResearchNews";
            request.CommunicationId   = 12345;
            request.DeliveryType      = EmailType.Html;
            request.TriggerDataSource = TriggerDataSource.None;
            request.TriggerType       = TriggeredSendType.NoDelay;
            request.Subscribers       = new GenericSubscriber[1];
            request.Subscribers[0]    = newSubscriber;

            EmailInterchangeResult result = EmailInterchangeResult.None;

            try
            {
                AzureTBNClientSDK.InterchangeConnect client = new AzureTBNClientSDK.InterchangeConnect();
                result = client.Send(request);

                return((result != EmailInterchangeResult.Success) ? false : true);
            }
            catch (Exception ex)
            {
                Console.WriteLine("An error occured sending the welcome email. " + ex);
            }

            return(false);
        }
        /// <summary>
        /// Test Method for BulkSend
        /// </summary>
        /// <returns></returns>
        private static string BulkSend(string batchId, string bulkSendId, int contentId, string filePath, string tenantAccountId, BulkSendEmailType bulkSendEmailType, bool isSendInvoke, bool isDynamicDataExtension, bool isOverrideConfiguration, DataImportType dataImportType, string dynamicDataExtensionTemplateName)
        {
            //"b480ee7d-2444-4f37-ba6d-db279b87b60a","b480ee7d-2444-4f37-ba6d-db279b87b60a",@"D:\Usr\ShankarBaradwaj\MslMailerBulkSendList-20150313-255746814.tsv","10290011",BulkSendEmailType.Transactional,true, true,true,DataImportType.AddAndUpdate,"MSL Email Campaigns DE"
            var fileRequest = new FileRequest()
            {
                BatchId                          = batchId,
                BulkSendId                       = bulkSendId,
                ContentId                        = contentId,
                FilePath                         = filePath,
                TenantAccountId                  = tenantAccountId,
                BulkSendEmailType                = bulkSendEmailType,
                IsSendInvoke                     = isSendInvoke,
                IsDynamicDataExtension           = isDynamicDataExtension,
                IsOverrideConfiguration          = isOverrideConfiguration,
                DataImportType                   = dataImportType,
                DynamicDataExtensionTemplateName = dynamicDataExtensionTemplateName
            };

            var azureTBNClient = new AzureTBNClientSDK.InterchangeConnect();
            var filesendResult = azureTBNClient.SendFileRequest(fileRequest);

            return(filesendResult.Result + "; EI ID: '" + filesendResult.EmailInterchangeId + "'");
        }