Beispiel #1
0
        public string CreateCampaign(SendinBlueCampaignRequest request)
        {
            string IdCampaign = string.Empty;

            try
            {
                ApiKey = request.ApiKey;

                if (ApiKey != string.Empty)
                {
                    APISendingBlue sendinBlue             = new APISendingBlue(ApiKey);
                    var            data                   = request.GetSendinBlueCampaignRequestObject();
                    dynamic        createCampaignResponse = sendinBlue.create_campaign(data);
                    if (createCampaignResponse.code == "success")
                    {
                        IdCampaign = createCampaignResponse.data.id;
                    }
                    else
                    {
                        SendinBlueResponse wrong = new SendinBlueResponse();
                        wrong = createCampaignResponse;
                        string error = wrong.message;

                        string messageError = string.Format("Something goes wrong, detail:{0}", error);
                    }
                }
            }
            catch (Exception e)
            {
                string exceptionMessage = telemetria.MakeMessageException(e, System.Reflection.MethodBase.GetCurrentMethod().Name);
                telemetria.Critical(exceptionMessage);
            }
            return(IdCampaign);
        }
Beispiel #2
0
        public void CreateCampaignTest()
        {
            if (ApiKey != string.Empty)
            {
                APISendingBlue sendinBlue        = new APISendingBlue(ApiKey);
                Dictionary <string, Object> data = new Dictionary <string, Object>();
                List <int> listid = new List <int>();
                listid.Add(2);
                data.Add("category", "My category");
                data.Add("from_name", "[DEFAULT_FROM_NAME]");
                data.Add("name", "My Campaign 1");
                data.Add("bat", "");
                data.Add("html_content", "<html><body><pre> Corramos con el peje este 4 de julio a festejar a su depa </pre></body></html>");
                data.Add("html_url", "");
                data.Add("listid", listid);
                data.Add("scheduled_date", "2018-05-16 16:05:01");
                data.Add("subject", "My Subject");
                data.Add("from_email", "*****@*****.**");
                data.Add("reply_to", "[DEFAULT_REPLY_TO]");
                data.Add("to_field", "[PRENOM] [NOM]");
                data.Add("exclude_list", new List <int>());
                data.Add("attachment_url", "");
                data.Add("inline_image", 1);
                data.Add("mirror_active", 0);
                data.Add("send_now", 0);
                data.Add("utm_campaign", "My UTM Value1");

                Object createCampaign = sendinBlue.create_campaign(data);
                Console.WriteLine(createCampaign);
            }
        }