/// <summary> /// To run this application, the following is required: /// /// - API token key/secret from Account -> Developer -> API Tokens /// - A verified Phone Number UUID from Account -> Email -> Email IDs -> Edit (in the URI) /// - Fill in variables to run example /// </summary> /// <param name="args"></param> async static Task Main(string[] args) { var tokenKey = ""; var tokenSecret = ""; // Set the Email ID (e.g., NbXW9TCHax9zfAeDhaY2bG) var emailId = ""; // Recipient email address var to = ""; // Initialize SDK OmnigageClient.Init(tokenKey, tokenSecret); // Create email message var message = new EmailMessageResource { Subject = "Ahoy", Body = "Sample body" }; await message.Create(); // Send email var email = new EmailResource { To = to, EmailMessage = message, EmailId = new EmailIdResource { Id = emailId } }; await email.Create(); }
async public Task TestEmailMessage() { var scotchMode = ScotchMode.Replaying; var client = HttpClients.NewHttpClient("IntegrationTests/Cassettes/EmailMessage.json", scotchMode); string tokenKey = "key"; string tokenSecret = "secret"; string host = "https://dvfoa3pu2rxx6.cloudfront.net/api/v1/"; OmnigageClient.Init(tokenKey, tokenSecret, host, client); EmailMessageResource emailMessage = new EmailMessageResource(); emailMessage.Subject = "Ahoy"; emailMessage.Body = "Sample body"; await emailMessage.Create(); EmailResource email = new EmailResource(); email.To = "*****@*****.**"; email.EmailMessage = emailMessage; email.EmailId = new EmailIdResource { Id = "NbXW9TCHax9zfAeDhaY2bG" }; await email.Create(); }
async public Task TestEmailVoiceEngagement() { var scotchMode = ScotchMode.Replaying; var client = HttpClients.NewHttpClient("IntegrationTests/Cassettes/EngagementEmailVoiceTests.json", scotchMode); string tokenKey = "key"; string tokenSecret = "secret"; string host = "https://dvfoa3pu2rxx6.cloudfront.net/api/v1/"; OmnigageClient.Init(tokenKey, tokenSecret, host, client); EngagementResource engagement = new EngagementResource(); engagement.Name = "Example Email Voice Blast (Voice Link)"; engagement.Direction = "outbound"; await engagement.Create(); EmailTemplateResource emailTemplate = new EmailTemplateResource(); emailTemplate.Subject = "Email Template"; emailTemplate.Body = "Email template with {{message-body}}."; await emailTemplate.Create(); EmailMessageResource emailMessage = new EmailMessageResource(); emailMessage.Subject = "Email Message"; emailMessage.Body = "Sample body"; emailMessage.IsDraft = true; await emailMessage.Create(); UploadResource upload1 = new UploadResource { FilePath = "Media/hello.mp3" }; await upload1.Create(); VoiceTemplateResource recording = new VoiceTemplateResource(); recording.Name = "Voice Link Recording"; recording.Kind = "audio"; recording.Upload = upload1; await recording.Create(); ActivityResource activity = new ActivityResource(); activity.Name = "Email Voice"; activity.Kind = ActivityKind.EmailVoice; activity.CallBackPhoneNumber = "+11231231234"; activity.Engagement = engagement; activity.VoiceTemplate = recording; activity.EmailTemplate = emailTemplate; activity.EmailMessage = emailMessage; activity.EmailId = new EmailIdResource { Id = "NbXW9TCHax9zfAeDhaY2bG" }; await activity.Create(); EnvelopeResource envelope = new EnvelopeResource(); envelope.EmailAddress = "*****@*****.**"; envelope.Engagement = engagement; envelope.Meta = new Dictionary <string, string> { { "first-name", "Omnigage" }, { "last-name", "Demo" } }; // Push one or more envelopes into list List <EnvelopeResource> envelopes = new List <EnvelopeResource> { }; envelopes.Add(envelope); // Populate engagement queue await OmnigageClient.PostBulkRequest("envelopes", EnvelopeResource.SerializeBulk(envelopes)); // Schedule engagement for processing engagement.Status = "scheduled"; await engagement.Update(); }