Skip to content

Alerts

Alerts are useful in various contexts to provide quick information about the processing of a task. You can emit custom alerts through two SDK methods:

  • Alert
  • Message

BotCity Orchestrator

You can view the Alerts functionality directly on the BotCity Orchestrator platform.

See more at:

Emit an Alert

The Alert method is used in the context of notifying users who have access to the BotCity Orchestrator workspace.

To create an Alert with the SDK, you need the following information:

  • Task ID: Reference of the task that will emit the alert.
  • Title: The customizable title.
  • Message: A detailed message about the alert.
  • Alert type: Type defined with the AlertType class, can be:
    • INFO: Information alert.
    • WARN: Warning alert.
    • ERROR: Error alert.

Tip

You can configure in the Orchestrator which users should also receive the Alert by email.

See an alert example:

maestro.alert(
    task_id=<TASK_ID>,
    title="Information alert",
    message="This is an information alert",
    alert_type=AlertType.INFO
)
maestro.alert(
    <TASK_ID>, 
    "Information alert", 
    "This is an information alert",
    AlertType.INFO
);
const alert = await maestro.alert(
    <TASK_ID>, 
    "Information alert", 
    "This is an information alert", 
    "INFO"
)
const alert: Alert = await maestro.alert(
    <TASK_ID>, 
    "Information alert", 
    "This is an information alert", 
    "INFO"
)
using Dev.BotCity.MaestroSdk.Model.Alert;

await maestro.CreateAlertAsync(
    <TASK_ID>,
    "Information alert",
    "This is an information alert",
    AlertTypeEnum.INFO
);

Emit a Message

The Message method can be used to notify anyone, without requiring access to the BotCity Orchestrator workspace.

Messages are sent directly to email addresses, opening up the possibility of notifying external users in a simple way.

To create a Message, you need the following information:

  • Emails: List of emails to send the message to.
  • Users: List of usernames with access to the BotCity Orchestrator.
  • Subject: Customizable text as the email subject.
  • Body: The email body.
  • Message type: Type defined with the MessageType class, can be:
    • TEXT: Plain text message body.
    • HTML: Message body formatted in HTML.

Attention!

The message sending method has a limit of 50 recipients per call.

Here is an example of sending a message through the Maestro SDK:

# List of emails, if not using, pass an empty list
emails = ["your_email@your_email.com"]
# List of users, if not using, pass an empty list
users = ["orchestrator_user1", "orchestrator_user2"]

# Email subject and body
subject = "Message subject"
email_body = "This is the message content."

maestro.message(
    email=emails, 
    users=users, 
    subject=subject, 
    body=email_body, 
    msg_type=MessageType.TEXT,
    )
// List of emails, if not using, pass an empty list
List<String> emails = new ArrayList<String>();
emails.add("your_email@your_email.com");

// List of users, if not using, pass an empty list
List<String> users = new ArrayList<String>();
users.add("orchestrator_user1");
users.add("orchestrator_user2");

// Email subject and body
String subject = "Test message";
String emailBody = "This is the message content.";

maestro.message(emails, users, subject, emailBody, MessageType.TEXT);
// List of emails, if not using, pass an empty list
const emails = ["your_email@your_email.com"]
// List of usernames, if not using, pass an empty list
const users = ["orchestrator_user1", "orchestrator_user2"]

// Email subject and body
const subject = "Test message"
const emailBody = "This is the message content."

await maestro.message(emails, users, subject, emailBody, "TEXT")
// List of emails, if not using, pass an empty list
const emails: array = ["your_email@your_email.com"]
// List of usernames, if not using, pass an empty list
const users: array = ["orchestrator_user1", "orchestrator_user2"]

// Email subject and body
const subject: string = "Test message"
const emailBody: string = "This is the message content."

await maestro.message(emails, users, subject, emailBody, "TEXT")
// List of emails, if not using, pass an empty list
List<string> emails = ["your_email@your_provider.com"];
// List of usernames, if not using, pass an empty list
List<string> users = ["maestro_user1", "maestro_user2"];

// Email subject and body
string subject = "Test message";
string body = "This is the message content.";

await maestro.SendMessageAsync(emails, users, subject, body, MessageTypeEnum.TEXT);