diff --git a/service/providers/notifications.py b/service/providers/notifications.py
new file mode 100644
index 0000000..925eaba
--- /dev/null
+++ b/service/providers/notifications.py
@@ -0,0 +1,91 @@
+import os
+
+__author__ = 'hanl'
+
+path = os.path.dirname(__file__)
+# modify this to change the Template Directory
+TEMPLATE_DIR = '/templates/'
+
+
+class Handler(object):
+    def register(self, key, value):
+        setattr(self, key, value)
+
+
+    def get(self, key):
+        if hasattr(self, key):
+            return getattr(self, key)
+
+
+
+# for possible email usage
+class MessageTemplate(object):
+    def __init__(self, template_name=None, html=True, values={}):
+        self.values = values
+        self.template_name = template_name
+        self.html = html
+
+    def render(self):
+        content = open(os.path.join(path, TEMPLATE_DIR, self.template_name)).read()
+        for k, v in self.values.iteritems():
+            content = content.replace('%%s%%' % k, v)
+        return content
+
+
+class HtmlBuilder(object):
+    def __init__(self):
+        self.title = None
+        self.head = None
+        self.body = None
+
+    def appendHead(self, head):
+        if not self.head:
+            self.head = ""
+        self.head.append("\n" + head)
+
+    def appendBody(self, body):
+        if not self.body:
+            self.body = ""
+        self.head.append("\n" + body)
+
+
+
+
+class NotificationHandler(object):
+
+    @staticmethod
+    def isError(response):
+        try:
+            raw_json = response.json()
+            if raw_json.get('errors') or raw_json.get('error') or raw_json.get('err'):
+                return True
+        except ValueError:
+            if response.status_code != 200:
+                return True
+        return False
+
+    @staticmethod
+    def getMessage(response):
+        pass
+
+    @staticmethod
+    def notify(json, notify_func, **kwargs):
+        if "category" not in kwargs.keys():
+            kwargs['category'] = "danger"
+
+        if json.get('errors'):
+            for error in json.get("errors"):
+                notify_func(error[1], "danger")
+        elif json.get('error'):
+            if json.get('error_description'):
+                notify_func(json.get('error_description'), **kwargs)
+            else:
+                notify_func(json.get('error'), **kwargs)
+        elif json.get('err'):
+            notify_func(json.get('errstr'), **kwargs)
+
+    @staticmethod
+    def getLocalized(code):
+        # return _("status_" + str(code))
+        return "this is a default message"
+
