EmailTrigger.CreateEmailTriggerAsync
Description
The API creates a new Email Trigger with the specified details inside the connected AI Command Center. The newly created trigger can be found in the AI Command Center under the Automations-->Triggers section.
Signature [C#]
Task<EmailTrigger> CreateEmailTriggerAsync(NewEmailTrigger newEmailTrigger);
Properties
Input
| Parameter | Type | Required / default | Description |
|---|---|---|---|
newEmailTrigger | NewEmailTrigger | Required | The new email trigger details to be created. |
Output
| Property | Description |
|---|---|
| Task<EmailTrigger> | Returns newly created email trigger. |
Remarks
Use CreateEmailTriggerAsync API to create a new Email Trigger inside the connected AI Command Center.
Example
C#
public async Task CreateEmailTrigger()
{
IControlRoomContext context = LoginControlRoom();
try
{
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 = await context.EmailTriggers.CreateEmailTriggerAsync(newEmailTrigger);
System.Console.WriteLine("Email Trigger Name: " + createEmailTrigger.Name);
}
finally
{
context.Close();
}
}
Connection helper
public IControlRoomContext LoginControlRoom()
{
string RequiredSetting(string name) => Environment.GetEnvironmentVariable(name) ?? throw new InvalidOperationException($"Set {name} before running this example.");
string serverUrl = RequiredSetting("INTELLIBUDDIES_SERVER_URL");
string userName = RequiredSetting("INTELLIBUDDIES_USERNAME");
string password = RequiredSetting("INTELLIBUDDIES_PASSWORD");
string connectionString = $"ServerUrl={serverUrl};UserName={userName};Password={password}";
IControlRoomContext context = new ControlRoomContext(connectionString);
context.Open();
return context;
}
See Get started for namespaces, configuration, and context cleanup, and SDK usage for error handling.