Skip to main content
Version: Current

Bots.GetBotByIdAsync

Description​

Gets an Assistant Buddy with the specified Id

Signature [C#]​

Task<BotInfo> GetBotByIdAsync(int botId);

Properties​

Input​

ParameterTypeRequired / defaultDescription
botIdintRequiredSpecify the Id of the Assistant Buddy to retrive whose information.

Output​

PropertyDescription
BotInfoReturns the information of the specified Assistant Buddy

Remarks​

Use GetBotByIdAsync API to return information about the specified Assistant Buddy from the connected AI Command Center.

Example​

C#
public async Task GetAssistantBuddyById()
{
IControlRoomContext context = LoginControlRoom();
try
{
int botId = 1;
BotInfo botInfo = await context.Bots.GetBotByIdAsync(botId);
Console.WriteLine("BotName: " + botInfo.BotName);
}
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.