Skip to main content

EmailTrigger.CreateEmailTriggerAsync

Description

The API creates a new Email Trigger with the specified details inside the connected Control Room. The newly created trigger can be found in the Control Room under the Automations-->Triggers section.

Signature [C#]

Task<EmailTrigger> CreateEmailTriggerAsync(NewEmailTrigger newEmailTrigger)

Properties

Input

PropertyDescription
NewEmailTriggerThe new email trigger details to be created.

Output

PropertyDescription
Task<EmailTrigger>Returns newly created email trigger.

Remarks

Use CreateEmailTriggerAsync API to create a new Email Trigger inside the connected Control Room.

Example

C#
public void CreateEmailTrigger()
{
IControlRoomContext context = LoginControlRoom("RegularBuild", "BasicAuth");
NewEmailTrigger newEmailTrigger = new NewEmailTrigger()
{
Name = "EmailTrigger01",
ProcessId = 1,
BotId = 1,
ConnectionId = 5,
FilterEnabled = false,
LogLevel = "Information",
IsFrequencyEnabled = true,
FrequencyMins = 1,
StartDate = DateTime.UtcNow,
ExpiresOn = DateTime.UtcNow.AddDays(1)
};

EmailTrigger createEmailTrigger = Task.Run(() => context.EmailTriggers.CreateEmailTriggerAsync(newEmailTrigger)).Result;
System.Console.WriteLine("Email Trigger Name: " + createEmailTrigger.Name);
}
C#
public IControlRoomContext LoginControlRoom()
{
IControlRoomContext context;
string connectionString;

connectionString = "ServerUrl=https://demo.onnitellibuddies.com;UserName=demoadmin;Password=password";
context = new ControlRoomContext(connectionString);

context.Open();
return context;
}