/// <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 -> Telephony -> Phone Numbers -> 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 Phone Number ID (e.g., GncieHvbCKfMYXmeycoWZm) var phoneNumberId = ""; // Sample contact information to call var to = ""; // In E.164 format (such as +1xxxxxxxxx) // Initialize SDK OmnigageClient.Init(tokenKey, tokenSecret); var message = new TextMessageResource { Body = "Sample body" }; await message.Create(); var text = new TextResource { To = to, TextMessage = message, PhoneNumber = new PhoneNumberResource { Id = phoneNumberId } }; await text.Create(); }
public void TestDefaultProps() { OmnigageClient.Init("key", "secret"); Assert.AreEqual(Client.Host, "https://api.omnigage.io/api/v1/"); Assert.IsInstanceOf <HttpClient>(Client.HttpClient); }
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(); }
/// <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(); }
public void TestPropsJWT() { OmnigageClient.Init("token"); Assert.AreEqual(Client.Auth.Authorization, "Bearer token"); Assert.IsInstanceOf <HttpClient>(Client.HttpClient); }
async public Task TestTextMessage() { var scotchMode = ScotchMode.Replaying; var client = HttpClients.NewHttpClient("IntegrationTests/Cassettes/TextMessage.json", scotchMode); string tokenKey = "key"; string tokenSecret = "secret"; string host = "https://dvfoa3pu2rxx6.cloudfront.net/api/v1/"; OmnigageClient.Init(tokenKey, tokenSecret, host, client); TextMessageResource textMessage = new TextMessageResource(); textMessage.Body = "Sample body"; await textMessage.Create(); TextResource text = new TextResource(); text.To = "+14076413749"; text.TextMessage = textMessage; text.PhoneNumber = new PhoneNumberResource { Id = "GncieHvbCKfMYXmeycoWZm" }; await text.Create(); }
public void TestProps() { string tokenKey = "key"; string tokenSecret = "secret"; string host = "http://localhost/api/"; OmnigageClient.Init(tokenKey, tokenSecret, host); Assert.AreEqual(Client.Host, host); Assert.AreEqual(Client.Auth.Authorization, "Basic a2V5OnNlY3JldA=="); Assert.IsInstanceOf <HttpClient>(Client.HttpClient); }
public static void Init() { var builder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json"); var configuration = builder.Build(); var config = configuration.GetSection("Omnigage") .Get <OmnigageSettings>(); // Initialize SDK OmnigageClient.Init(config.ApiTokenKey, config.ApiTokenSecret, config.ApiHost); }
public void TestValidationException() { var mockHttp = new MockHttpMessageHandler(); mockHttp.When(HttpMethod.Post, "http://localhost/api/test") .Respond(HttpStatusCode.BadRequest, "application/json", ""); var httpClient = mockHttp.ToHttpClient(); string tokenKey = "key"; string tokenSecret = "secret"; string host = "http://localhost/api/"; OmnigageClient.Init(tokenKey, tokenSecret, host, httpClient); Assert.ThrowsAsync <ValidationException>(() => Client.SendClientRequest("POST", "test")); }
async public Task TestCallParent() { var scotchMode = ScotchMode.Replaying; var client = HttpClients.NewHttpClient("IntegrationTests/Cassettes/CallParentTests.json", scotchMode); string tokenKey = "key"; string tokenSecret = "secret"; string host = "https://dvfoa3pu2rxx6.cloudfront.net/api/v1/"; OmnigageClient.Init(tokenKey, tokenSecret, host, client); var call = new CallResource(); call.To = "+18332676094"; call.Action = CallAction.Dial; await call.Create(); }
async public Task TestCreate() { var mockHttp = new MockHttpMessageHandler(); var response = File.ReadAllText("UnitTests/Serialized/UtilTestsCreate.json"); mockHttp.When(HttpMethod.Post, "http://localhost/api/articles") .Respond(System.Net.HttpStatusCode.Created, "application/json", response); var client = mockHttp.ToHttpClient(); client.BaseAddress = new Uri("http://localhost/api/"); OmnigageClient.Init("key", "secret", "http://localhost/api/", client); await fixture.Create(); Assert.AreEqual(fixture.Id, "1"); }
async public Task TestCallChild() { var scotchMode = ScotchMode.Replaying; var client = HttpClients.NewHttpClient("IntegrationTests/Cassettes/CallChildTests.json", scotchMode); string tokenKey = "key"; string tokenSecret = "secret"; string host = "https://dvfoa3pu2rxx6.cloudfront.net/api/v1/"; OmnigageClient.Init(tokenKey, tokenSecret, host, client); OmnigageClient.IsTesting = true; CallResource parentCall = new CallResource(); parentCall.To = "+18332676094"; parentCall.Action = CallAction.Dial; await parentCall.Create(); while (true) { if (parentCall.Status == "in-progress") { break; } else { await parentCall.Reload(); } } CallResource childCall = new CallResource(); childCall.To = "+14076413749"; childCall.Action = CallAction.Dial; childCall.ParentCall = parentCall; childCall.CallerId = new CallerIdResource { Id = "yL9vQaWrSqg5W8EFEpE6xZ" }; await childCall.Create(); }
async public Task TestCallParentChild() { var scotchMode = ScotchMode.Replaying; var client = HttpClients.NewHttpClient("IntegrationTests/Cassettes/CallParentChildTests.json", scotchMode); string tokenKey = "key"; string tokenSecret = "secret"; string host = "https://dvfoa3pu2rxx6.cloudfront.net/api/v1/"; OmnigageClient.Init(tokenKey, tokenSecret, host, client); OmnigageClient.IsTesting = true; CallResource call = new CallResource(); call.From = "+18332676094"; call.To = "+14076413749"; call.Action = CallAction.Dial; call.CallerId = new CallerIdResource { Id = "yL9vQaWrSqg5W8EFEpE6xZ" }; await call.Create(); }
async public Task TestVoiceEngagement() { var mockHttp = new MockHttpMessageHandler(); var engagementResponse = File.ReadAllText("UnitTests/Serialized/ResourceTestsEngagementResponse.json"); var activityResponse = File.ReadAllText("UnitTests/Serialized/ResourceTestsActivityResponse.json"); var triggerResponse = File.ReadAllText("UnitTests/Serialized/ResourceTestsTriggerResponse.json"); var envelopeRequest = File.ReadAllText("UnitTests/Serialized/ResourceTestsEnvelopeBulkRequest.json"); mockHttp.When(HttpMethod.Post, "http://localhost/api/engagements") .Respond(System.Net.HttpStatusCode.Created, "application/json", engagementResponse); mockHttp.When(HttpMethod.Post, "http://localhost/api/activities") .Respond(System.Net.HttpStatusCode.Created, "application/json", activityResponse); mockHttp.When(HttpMethod.Post, "http://localhost/api/triggers") .Respond(System.Net.HttpStatusCode.Created, "application/json", triggerResponse); var httpClient = mockHttp.ToHttpClient(); OmnigageClient.Init("key", "secret", "http://localhost/api/", httpClient); EngagementResource engagement = new EngagementResource(); engagement.Name = "Example"; engagement.Direction = "outbound"; engagement.Status = "scheduled"; await engagement.Create(); Assert.AreEqual(engagement.Id, "1"); Assert.AreEqual(engagement.ToString(), engagementResponse); ActivityResource activity = new ActivityResource(); activity.Name = "Voice Blast"; activity.Kind = "voice"; activity.Engagement = engagement; activity.CallerId = new CallerIdResource { Id = "yL9vQaWrSqg5W8EFEpE6xZ" }; await activity.Create(); Assert.AreEqual(activity.Id, "1"); Assert.AreEqual(activity.Name, "Voice Blast"); Assert.AreEqual(activity.Kind, "voice"); TriggerResource trigger = new TriggerResource(); trigger.Kind = "play"; trigger.OnEvent = "voice-machine"; trigger.Activity = activity; trigger.VoiceTemplate = new VoiceTemplateResource { Id = "RaF56o2r58hTKT7AYS9doj" }; await trigger.Create(); Assert.AreEqual(trigger.Id, "1"); Assert.AreEqual(trigger.Kind, "play"); Assert.AreEqual(trigger.OnEvent, "voice-machine"); EnvelopeResource envelope = new EnvelopeResource(); envelope.PhoneNumber = "+11111111111"; envelope.Engagement = engagement; envelope.Meta = new Dictionary <string, string> { { "first-name", "Michael" }, { "last-name", "Morgan" } }; List <EnvelopeResource> envelopes = new List <EnvelopeResource> { }; envelopes.Add(envelope); string envelopesPayload = EnvelopeResource.SerializeBulk(envelopes); Assert.AreEqual(envelopesPayload, envelopeRequest); }
/// <summary> /// To run this application, the following is required: /// /// - API token key/secret from Account -> Developer -> API Tokens /// - Two audio files (either wav or mp3) /// - A Caller ID UUID from Account -> Telephony -> Caller IDs -> Edit (in the URI) /// </summary> /// <param name="args"></param> async static Task Main(string[] args) { string tokenKey = ""; string tokenSecret = ""; // Set the Caller ID (e.g., yL9vQaWrSqg5W8EFEpE6xZ) string callerId = ""; // Sample contact information to call string firstName = ""; string lastName = ""; string phoneNumber = ""; // In E.164 format with country code (e.g., +11235551234) // Audio path for when human is detected string audioFilePath1 = ""; // Full path to audio file (e.g., /Users/Shared/piano.wav on Mac) // Audio path for machine detection string audioFilePath2 = ""; // Full path to audio file (e.g., /Users/Shared/nimoy_spock.wav on Mac) // Initialize SDK OmnigageClient.Init(tokenKey, tokenSecret); var engagement = new EngagementResource(); engagement.Name = "Example Voice Blast"; engagement.Direction = "outbound"; await engagement.Create(); var activity = new ActivityResource(); activity.Name = "Voice Blast"; activity.Kind = ActivityKind.Voice; activity.Engagement = engagement; activity.CallerId = new CallerIdResource { Id = callerId }; await activity.Create(); var upload1 = new UploadResource { FilePath = audioFilePath1 }; await upload1.Create(); var upload2 = new UploadResource { FilePath = audioFilePath2 }; await upload2.Create(); var humanRecording = new VoiceTemplateResource(); humanRecording.Name = "Human Recording"; humanRecording.Kind = "audio"; humanRecording.Upload = upload1; await humanRecording.Create(); var machineRecording = new VoiceTemplateResource(); machineRecording.Name = "Machine Recording"; machineRecording.Kind = "audio"; machineRecording.Upload = upload2; await machineRecording.Create(); // Define human trigger var triggerHumanInstance = new TriggerResource(); triggerHumanInstance.Kind = TriggerKind.Play; triggerHumanInstance.OnEvent = TriggerOnEvent.VoiceHuman; triggerHumanInstance.Activity = activity; triggerHumanInstance.VoiceTemplate = humanRecording; await triggerHumanInstance.Create(); // Define machine trigger var triggerMachineInstance = new TriggerResource(); triggerMachineInstance.Kind = TriggerKind.Play; triggerMachineInstance.OnEvent = TriggerOnEvent.VoiceMachine; triggerMachineInstance.Activity = activity; triggerMachineInstance.VoiceTemplate = machineRecording; await triggerMachineInstance.Create(); var envelope = new EnvelopeResource(); envelope.PhoneNumber = phoneNumber; envelope.Engagement = engagement; envelope.Meta = new Dictionary <string, string> { { "first-name", firstName }, { "last-name", lastName } }; // Push one or more envelopes into list List <EnvelopeResource> envelopes = new List <EnvelopeResource> { }; envelopes.Add(envelope); // Populate engagement queue await Client.PostBulkRequest("envelopes", EnvelopeResource.SerializeBulk(envelopes)); // Schedule engagement for processing engagement.Status = "scheduled"; await engagement.Update(); }
/// <summary> /// To run this application, the following is required: /// /// - API token key/secret from Account -> Developer -> API Tokens /// - A verified Email ID 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 = ""; // Sample contact information to call var firstName = ""; var lastName = ""; var emailAddress = ""; // Initialize SDK OmnigageClient.Init(tokenKey, tokenSecret); var engagement = new EngagementResource(); engagement.Name = "Example Email Blast"; engagement.Direction = "outbound"; await engagement.Create(); var emailTemplate = new EmailTemplateResource(); emailTemplate.Subject = "Ahoy"; emailTemplate.Body = "Sample body"; await emailTemplate.Create(); var activity = new ActivityResource(); activity.Name = "Email Blast"; activity.Kind = ActivityKind.Email; activity.Engagement = engagement; activity.EmailTemplate = emailTemplate; activity.EmailId = new EmailIdResource { Id = emailId }; await activity.Create(); var envelope = new EnvelopeResource(); envelope.EmailAddress = emailAddress; envelope.Engagement = engagement; envelope.Meta = new Dictionary <string, string> { { "first-name", firstName }, { "last-name", lastName } }; // Push one or more envelopes into list List <EnvelopeResource> envelopes = new List <EnvelopeResource> { }; envelopes.Add(envelope); // Populate engagement queue await Client.PostBulkRequest("envelopes", EnvelopeResource.SerializeBulk(envelopes)); // Schedule engagement for processing engagement.Status = "scheduled"; await engagement.Update(); }
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(); }
async public Task TestTextEngagement() { var scotchMode = ScotchMode.Replaying; var client = HttpClients.NewHttpClient("IntegrationTests/Cassettes/EngagementTextTests.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 Text Blast"; engagement.Direction = "outbound"; await engagement.Create(); TextTemplateResource textTemplate = new TextTemplateResource(); textTemplate.Name = "Text Template"; textTemplate.Body = "Sample body"; await textTemplate.Create(); ActivityResource activity = new ActivityResource(); activity.Name = "Text Blast"; activity.Kind = ActivityKind.Text; activity.Engagement = engagement; activity.TextTemplate = textTemplate; activity.PhoneNumber = new PhoneNumberResource { Id = "GncieHvbCKfMYXmeycoWZm" }; await activity.Create(); EnvelopeResource envelope = new EnvelopeResource(); envelope.PhoneNumber = "+14076413749"; 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 Client.PostBulkRequest("envelopes", EnvelopeResource.SerializeBulk(envelopes)); // Schedule engagement for processing engagement.Status = "scheduled"; await engagement.Update(); }
async public Task TestVoiceEngagement() { var scotchMode = ScotchMode.Replaying; var client = HttpClients.NewHttpClient("IntegrationTests/Cassettes/EngagementTests.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 Voice Blast"; engagement.Direction = "outbound"; await engagement.Create(); ActivityResource activity = new ActivityResource(); activity.Name = "Voice Blast"; activity.Kind = ActivityKind.Voice; activity.Engagement = engagement; activity.CallerId = new CallerIdResource { Id = "yL9vQaWrSqg5W8EFEpE6xZ" }; await activity.Create(); UploadResource upload1 = new UploadResource { FilePath = "Media/hello.mp3" }; await upload1.Create(); UploadResource upload2 = new UploadResource { FilePath = "Media/you-have-new-mail-waiting.wav" }; await upload2.Create(); VoiceTemplateResource humanRecording = new VoiceTemplateResource(); humanRecording.Name = "Human Recording"; humanRecording.Kind = "audio"; humanRecording.Upload = upload1; await humanRecording.Create(); VoiceTemplateResource machineRecording = new VoiceTemplateResource(); machineRecording.Name = "Machine Recording"; machineRecording.Kind = "audio"; machineRecording.Upload = upload2; await machineRecording.Create(); // Define human trigger TriggerResource triggerHumanInstance = new TriggerResource(); triggerHumanInstance.Kind = TriggerKind.Play; triggerHumanInstance.OnEvent = TriggerOnEvent.VoiceHuman; triggerHumanInstance.Activity = activity; triggerHumanInstance.VoiceTemplate = humanRecording; await triggerHumanInstance.Create(); // Define machine trigger TriggerResource triggerMachineInstance = new TriggerResource(); triggerMachineInstance.Kind = TriggerKind.Play; triggerMachineInstance.OnEvent = TriggerOnEvent.VoiceMachine; triggerMachineInstance.Activity = activity; triggerMachineInstance.VoiceTemplate = machineRecording; await triggerMachineInstance.Create(); EnvelopeResource envelope = new EnvelopeResource(); envelope.PhoneNumber = "+18332676094"; envelope.Engagement = engagement; envelope.Meta = new Dictionary <string, string> { { "first-name", "Spectrum" }, { "last-name", "Support" } }; // 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(); }
/// <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 -> Telephony -> Phone Numbers -> 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 Phone Number ID (e.g., GncieHvbCKfMYXmeycoWZm) var phoneNumberId = ""; // Sample contact information to call var firstName = ""; var lastName = ""; var phoneNumber = ""; // In E.164 format (such as +1xxxxxxxxx) // Initialize SDK OmnigageClient.Init(tokenKey, tokenSecret); var engagement = new EngagementResource { Name = "Example SMS Blast", Direction = "outbound" }; await engagement.Create(); var template = new TextTemplateResource { Name = "Text Template", Body = "Sample body" }; await template.Create(); var activity = new ActivityResource { Name = "SMS Blast", Kind = ActivityKind.Text, Engagement = engagement, TextTemplate = template, PhoneNumber = new PhoneNumberResource { Id = phoneNumberId } }; await activity.Create(); var envelope = new EnvelopeResource { PhoneNumber = phoneNumber, Engagement = engagement, Meta = new Dictionary <string, string> { { "first-name", firstName }, { "last-name", lastName } } }; // Push one or more envelopes into list List <EnvelopeResource> envelopes = new List <EnvelopeResource> { }; envelopes.Add(envelope); // Populate engagement queue await Client.PostBulkRequest("envelopes", EnvelopeResource.SerializeBulk(envelopes)); // Schedule engagement for processing engagement.Status = "scheduled"; await engagement.Update(); }
async public Task TestEmailEngagement() { var scotchMode = ScotchMode.Replaying; var client = HttpClients.NewHttpClient("IntegrationTests/Cassettes/EngagementEmailTests.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 Blast"; engagement.Direction = "outbound"; await engagement.Create(); EmailTemplateResource emailTemplate = new EmailTemplateResource(); emailTemplate.Subject = "Ahoy"; emailTemplate.Body = "Sample body"; await emailTemplate.Create(); ActivityResource activity = new ActivityResource(); activity.Name = "Email Blast"; activity.Kind = ActivityKind.Email; activity.Engagement = engagement; activity.EmailTemplate = emailTemplate; 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(); }