Custom Notifications using the Yo API

May 18th 16

I have continued to explore my interest with notifications and have started utilising the YO app api for straightforward alerts.

For those who aren’t aware YO is the most simplistic notification application possible. It allows users to send out alerts to their subscribers. That is it. There is no text attached to the alert other than the username and you cannot include any other data such as pictures. This limited functionality means the integration required however, is much lower than other exisiting services.

YO API

YO API

YO has opened it’s api up to developers. We can leverage it’s basic functionality for an uncomplicated notification service. It can be used as another channel to be kept informed if something important has happened.

Now, if we are sending multiple messages how do we determine the context? The solution is to use various accounts for different occurrences. Since YO is a popular service will most likely need to prefix your usernames. To get you imagining some of the possibilities I have included some scenarios:

  • COMPANYWHOBROKEIT for when continuous integration fails

  • COMPANYPLUS10 when 10 new customers join

  • COMPANYDEBUGTIME if an error is thrown on production

To use the api you need to register your application first. You can then start sending notifications.

There are plenty of ways you could integrate but here are some examples to get you started:

Git Hook

After a successful merge inside a git hook:

# ~/.git_template.local/hooks/post-merge

curl --data "api_token=$YO_API_TOKEN" //api.justyo.co/yoall/

JavaScript

In a node application using the excellent request package:

var request = require('request');

request.post('//api.justyo.co/yo/', {
    json: {
        'api_token': token,
        'username': user
    }
}, function(error, response, body) {
    console.log(body);
});

Schedule Node tasks and Email notifications with SES

Next