Skip to content
This repository has been archived by the owner on Feb 8, 2019. It is now read-only.

Commit

Permalink
change slack integration a little bit.
Browse files Browse the repository at this point in the history
  • Loading branch information
deathowl committed Jun 2, 2014
1 parent db50d89 commit c29f5f4
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#Integrations
Has been tested with Nagios, works well for us. Any Pagerduty Notifier using the Pagerduty API should work without a problem.
#Notifications
XMPP, email, SMS, Phone(Thanks Twilio for being awesome!), and Push notifications(thanks Pushover also) are supported at the moment.
XMPP, email, SMS, Phone(Thanks Twilio for being awesome!), and Push notifications(thanks Pushover also),and Slack are supported at the moment.
#Current status
Openduty is in Beta status, it can be considered stable at the moment, however major structural changes can appear anytime (not affecting the API, or the Notifier structure)

Expand Down
5 changes: 5 additions & 0 deletions extra/settings_prod.py.example
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ TWILIO_SETTINGS = {
'twiml_url': "http://www.website.org/voice.xml"
}

SLACK_SETTINGS = {
'apikey': "YOUR_SLACK_API_KEY"
}


DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
Expand Down
2 changes: 1 addition & 1 deletion notification/notifier/slack.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def __init__(self, config):

def notify(self, notification):
slack = Slacker(self.__config['apikey'])
response = slack.chat.post_message(self.__config['channel'], notification.message)
response = slack.chat.post_message(notification.user_to_notify.profile.slack_room_name, notification.message)
if not response.error:
print "Slack message sent"
else:
Expand Down
1 change: 1 addition & 0 deletions openduty/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ class UserProfile(models.Model):
phone_number = models.CharField(max_length=50)
pushover_user_key = models.CharField(max_length=50)
pushover_app_key = models.CharField(max_length=50)
slack_room_name = models.CharField(max_length=50)


def create_user_profile(sender, instance, created, **kwargs):
Expand Down
7 changes: 7 additions & 0 deletions openduty/templates/users/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@
<input type="text" class="form-control" name="pushover_app_key" value="{% if item %}{{ item.profile.pushover_app_key }}{% endif %}">
</div>
</div>
<div class="form-group">
<label for="slack_room_name" class="col-sm-2 control-label">Slack room name</label>

<div class="col-sm-10">
<input type="text" class="form-control" name="slack_room_name" value="{% if item %}{{ item.profile.slack_room_name }}{% endif %}">
</div>
</div>
<div class="form-group">
<label for="username" class="col-sm-2 control-label">Notification methods</label>
</div>
Expand Down
1 change: 1 addition & 0 deletions openduty/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ def save(request):
profile.phone_number = request.POST['phone_number']
profile.pushover_user_key = request.POST['pushover_user_key']
profile.pushover_app_key = request.POST['pushover_app_key']
profile.slack_room_name = request.POST['slack_room_name']
profile.save()

return HttpResponseRedirect('/');
Expand Down

0 comments on commit c29f5f4

Please sign in to comment.