SmartBuddies.CreateSmartBuddyAsync
Description
Creates a new Smart Buddy with specified NewSmartBuddyInfo details inside the connected AI Command Center.
Signature [C#]
Task<SmartBuddyInfo> CreateSmartBuddyAsync(NewSmartBuddyInfo newSmartBuddyInfo);
Properties
Input
| Parameter | Type | Required / default | Description |
|---|---|---|---|
newSmartBuddyInfo | NewSmartBuddyInfo | Required | Details to create new SmartBuddy. |
Output
| Type | Description |
|---|---|
| Task<SmartBuddyInfo> | Returns newly created SmartBuddy details. |
Remarks
Use CreateSmartBuddyAsync API to create new Smart Buddy with specified NewSmartBuddyInfo details inside the connected AI Command Center.
Example
C#
public async Task CreateSmartBuddy()
{
IControlRoomContext context = LoginControlRoom();
try
{
NewSmartBuddyInfo newSmartBuddyInfo = new NewSmartBuddyInfo()
{
UserId = 1,
StationId = 1,
Name = "Test_Buddy",
DomainUser = @"EXAMPLE\automation-user",
DomainPwd = Environment.GetEnvironmentVariable("INTELLIBUDDIES_DOMAIN_PASSWORD") ?? throw new InvalidOperationException("Set INTELLIBUDDIES_DOMAIN_PASSWORD."),
Description = "Smart buddy",
IsEnabled = true
};
SmartBuddyInfo smartBuddyInfo = await context.SmartBuddies.CreateSmartBuddyAsync(newSmartBuddyInfo);
System.Console.WriteLine("SmartBuddy Name: " + smartBuddyInfo.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.