Skip to content
AnnA Docs

AnnA Active Notification (C#/.NET)

AnnA Active Notification is a resource that makes possible for you to send notifications through WhatsApp to a batch of phone numbers.

Using AnnaTemplate class

This class will provide you a simple way to send active notifications to your clients

Examples:

  var template = new AnnaTemplate("YOUR_ANNA_ENVIRONMENT_BASE_URL");
  template.CompanyHash = "YOURCOMPANYHASH";
  template.EncryptionKey = "YOUR_TEMPLATES_ENCRYPTION_KEY";
  template.DecryptionKey = "YOUR_TEMPLATES_DECRYPTION_KEY";
  template.TemplateName = "TEMPLATE_NAME";
  template.TemplateNamespace = "TEMPLATE_NAMESPACE";
  template.Notifications = new List<AnnaNotification>(); // List of notification objects that contains PhoneList, PropKeys and PropParms

or

  var template = new AnnaTemplate("YOUR_ANNA_ENVIRONMENT_BASE_URL", new AnnaTemplateConfig
  {
      CompanyHash = "YOURCOMPANYHASH",
      EncryptionKey = "YOUR_TEMPLATES_ENCRYPTION_KEY",
      DecryptionKey = "YOUR_TEMPLATES_DECRYPTION_KEY",
      TemplateName = "TEMPLATE_NAME",
      TemplateNamespace = "TEMPLATE_NAMESPACE",
      Notifications = new List<AnnaNotification>() // List of notification objects that contains PhoneList, PropKeys and PropParms
  });

Send notifications

What you will need:

  • Base URL of your AnnA environment
  • Company hash
  • Encryption and decryption key
  • Template name
  • Template namespace
  • List of phone numbers

Optionally you can set:

  • List with the values of variables from the template if your template has any
  • List with parameters for the template if your template has any
  • Delivery date when you want or need to schedule the notification
  • Reference to any notes about this notification
  // Create notification
  var notification = new AnnaNotification
  {
      PhoneList = new List<string> { "5511111111111", "5522222222222" }, // List of phonenumbers
      PropKeys = new List<string> { "Variable 1" }, // List with the values of variables from the template
      PropParms = new List<PropParm>
      {
          new PropParm { Alias = "parm1", Value = "value1" },
          new PropParm { Alias = "parm2", Value = "value2" }
      },
      DeliveryDate = new DateTime(2023, 11, 02, 13, 20, 0), // Set this property if you want to schedule the notification
      Reference = "Any description you want (max 100 characters)"
  };

  // Add notification to the list
  var notificationsList = new List<AnnaNotification> { notification };

  // Create the template, set the configurations and notifications list
  // Example of AnnA environment base URL: https://learning.anna.center
  var template = new AnnaTemplate("YOUR_ANNA_ENVIRONMENT_BASE_URL", new AnnaTemplateConfig
  {
      CompanyHash = "YOURCOMPANYHASH",
      EncryptionKey = "YOUR_TEMPLATES_ENCRYPTION_KEY",
      DecryptionKey = "YOUR_TEMPLATES_DECRYPTION_KEY",
      TemplateName = "TEMPLATE_NAME",
      TemplateNamespace = "TEMPLATE_NAMESPACE",
      ReturnMode = TemplateReturnMode.DEFAULT, // Change to RESUME if you want information about the request instead of a phonelist when sending the notifications
      Notifications = notificationsList
  });

  string response = template.SendNotifications(); // Send the notifications and returns a JSON

Get notification data

When sending notifications with ReturnMode as RESUME, the response will be a RequestID that you can use to get the notification data.

This service will return information about the number of notifications sent, processed and processing.

What you will need:

  • Base URL of your AnnA environment
  • Company hash
  • Encryption and decryption key
  • RequestID
  // Create and configure AnnA Template
  // Example of AnnA environment base URL: https://learning.anna.center
  var template = new AnnaTemplate("YOUR_ANNA_ENVIRONMENT_BASE_URL", new AnnaTemplateConfig
  {
      CompanyHash = "YOURCOMPANYHASH",
      EncryptionKey = "YOUR_TEMPLATES_ENCRYPTION_KEY",
      DecryptionKey = "YOUR_TEMPLATES_DECRYPTION_KEY"
  });

  int requestId = 65; // RequestId from SendNotifications() reponse when ReturnMode is set to "RESUME"
  string response = template.GetNotificationData(requestId); // JSON response with the notification data