private const int ACCOUNT_ID = 0; // TODO: Fill in with your account ID #endregion Fields #region Methods private static Campaign CampaignSetup(T70Context context) { /* * NOTE: A campaign only needs to be setup once. * * After the initial setup you can send that campaign as many times as you would like. */ var contentRepo = context.Repository<Content>(new { AccountId = ACCOUNT_ID }); var content = new Content { Name = "SDK Test Content", }; contentRepo.Add(content); var templateRepo = context.Repository<ContentTemplate>(new { AccountId = ACCOUNT_ID, ContentId = content.Id }); var template = new ContentTemplate { LanguageType = LanguageType.English, ChannelType = ChannelType.Sms, EncodingType = EncodingType.Text, Template = "Hi there from our demo!" }; templateRepo.Add(template); var campaign = new Campaign { Name = "SDK Test Campaign", SubscriptionId = 183, CampaignType = CampaignType.Basic, ContentId = content.Id }; var campaignRepo = context.Repository<Campaign>(new { AccountId = ACCOUNT_ID }); campaignRepo.Add(campaign); return campaign; }
private static Content CreateContent(T70Context context) { /* * Content provides a grouping mechanism that can be used to * hold multiple translations for a single campaign. */ var contentRepo = context.Repository<Content>(new {AccountId = ACCOUNT_ID}); var content = new Content { Name = "SDK Test Content", }; contentRepo.Add(content); var templateRepo = context.Repository<ContentTemplate>(new {AccountId = ACCOUNT_ID, ContentId = content.Id}); var template = new ContentTemplate { LanguageType = LanguageType.English, ChannelType = ChannelType.Sms, EncodingType = EncodingType.Text, Template = "Hi there from our demo!" }; templateRepo.Add(template); // Also provide a French translation (not required) template = new ContentTemplate { LanguageType = LanguageType.French, ChannelType = ChannelType.Sms, EncodingType = EncodingType.Text, Template = "Bonjour!" }; templateRepo.Add(template); return content; }