Push Notifications via Slack

Push notifications are messages sent (pushed) to mobile and other devices. The notifications can be sent when immediate attention by customers, developers or the administrators are required.

Push Notification Service Examples

  • The web-server is close to running out of memory or disk-space. A health alert is pushed to notify the server admin.
  • A new Git development branch has been created for all future work. A push notification is sent to all the developers.
  • A credit-card purchase has been declined due to suspicious circumstances. The shop owner should be notified so that law enforcement can be alerted.

What is Slack?

Slack messaging platform allows team members to collaborate and work. Slack is also a push notification service that provide an API for group messaging to a shared channel. An intro to Slack is here.

Integrating your app with Slack

Your app can be integrated with Slack for collaborative development and to receive notifications. A Slack channel is needed to receive notifications.

connect the app to slack

I have created a MVC app called “Test MVC” using the Nester Deploy Tool to demonstrate the workflow. Click on the Slack button and then “Add to Slack Button”.

The Authorize dialog dropdown will display the available channels. Authorize the app to post messages to a channel.

Deploy the app once the above steps are complete.

Make the Code change

The default MVC app will be changed to send push notifications as follows;

Trigger a Notification

Run the app to display the following page. Sending a message will trigger a push notification to Slack. The message “Hello World” is sent from the home page as shown below.

trigger a push notification

The message as it appears on an Android device. The message was sent to the Slack channel selected above.

trigger a push notification

Conclusion

There are many instances where customers and managers of your organization would prefer to be notified whenever important or critical events occur. The push notification is an ideal way to keep important stakeholders informed.

Further Information