Getting Started

Getting started with the alertme service involves three simple steps:

  1. Signing up and creating topics.
  2. Deploying the alertme component into your application.
  3. Publishing alerts

Signing Up


In order to use the Alertme service, you must first sign up for an account

Pick a publisher id for your organization – typically the domain where the Alertme component will be placed. Pick a password, and provide the name and email of the administrator for this publisher id. The email will only be used to contact the administrator with important information about the Alertme service.

Creating Topics


After signing into the Alertme Administration portal, the first step is to define the Topics to which subscribers can subscribe to receive alerts. For example, the bank contoso.com might define the following topics:

The topics you define will be driven by your business model. The following information is required to set up a topic.

Basic Info

Parameters

Topics can define parameters that further control whether a subscriber will receive an alert for this topic. For example, the “low-balance” topic could have a parameter called “min-balance” where the subscriber will specify at what threshold they would like to receive this alert.

Lookups

For the lookup parameter type, you can provide a list of lookup values in either JSON, or CSV format. The following fields are provided for the lookup values:

Alert Text

Finally, provide the alert text to be sent to the subscriber when the alert is triggered. You can provide separate messages for emails and SMS text. You can also provide simple value substitutions using double curly braces. See the section on the API for how to pass in substitution data. The subject of the email will be the Topic Name, and the Topic Name will also be prepended to the SMS text. The email will come from [publisherId]@mail.alertmehub.com.

Deploying the component


The alertme component is the way that your users can subscribe to the alert topics that you’ve defined. It must be placed on a page of your existing portal. There are several different ways to accomplish this, depending on your portal technology stack.

ASP.NET If your portal is built on top of Microsoft ASP.NET MVC, then the process of deploying the component looks like this:

  1. Download the latest JavaScript from https://github.com/alertmehub/alertme-component-javascript/tree/master/lib.
  2. Place the html tag in your View html.
  3. In the controller, make an API call to get the token.

HTML View

  <alertme-preference-center publisher="test.com" token="@ViewBag.CustomerToken"></alertme-preference-center>
  <script type="text/javascript" src="alertme-1.0.4.js"></script>

ASP.NET Controller

        public async Task<IActionResult> Alerts()
        {
            string tokenUrl = "https://api.alertmehub.com/api/v1/subscriber/token/" + User.Identity.Name;
            using (var httpClient = new HttpClient())
            {
                httpClient.DefaultRequestHeaders.Add("Authorization",
                "4f0c8355d0107f3e4b4705b85085506a4567debfb0842d4b2ab1ee38dcd62ac5");

                try
                {
                    string response = await httpClient.GetStringAsync(tokenUrl);
                    ViewBag.CustomerToken = response.Replace("\"", "");
                }
                catch(HttpRequestException ex)
                {
                    ViewBag.Error = ex.Message;

                }
            }
            return View();
        }

Publishing Alerts


Publishing alerts is done through our API.

To publish an alert, make a POST request to https://api.alertmehub.com/api/v1/alert/ Set the authorization header to your API key. And set the document body to a JSON object like so:

{
  "topic": "topic1",
  "parameters":{"parameter1": 100},
  "data":{"name": "Eric"},
  "options":{"smsProvider": "manual", "emailProvider": "manual"}
}