Added icon_url functionality to mattermost notification

This commit is contained in:
anonaut 2017-03-14 00:15:26 +01:00
parent b287c8655f
commit 2f1060b665
4 changed files with 12 additions and 2 deletions

View file

@ -50,5 +50,6 @@ namespace Ombi.Api.Models.Notifications
} }
public string channel { get; set; } public string channel { get; set; }
public string text { get; set; } public string text { get; set; }
public string icon_url { get; set; }
} }
} }

View file

@ -8,5 +8,6 @@ namespace Ombi.Core.SettingModels
public string WebhookUrl { get; set; } public string WebhookUrl { get; set; }
public string Channel { get; set; } public string Channel { get; set; }
public string Username { get; set; } public string Username { get; set; }
public string IconUrl { get; set; }
} }
} }

View file

@ -125,7 +125,7 @@ namespace Ombi.Services.Notification
{ {
try try
{ {
var notification = new MattermostNotificationBody { username = config.Username, channel = config.Channel ?? string.Empty, text = message }; var notification = new MattermostNotificationBody { username = config.Username, channel = config.Channel ?? string.Empty, icon_url = config.IconUrl ?? string.Empty, text = message };
var result = await Api.PushAsync(config.WebhookUrl, notification); var result = await Api.PushAsync(config.WebhookUrl, notification);
if (!result.Equals("ok")) if (!result.Equals("ok"))

View file

@ -24,7 +24,7 @@
<div class="form-group"> <div class="form-group">
<label for="WebhookUrl" class="control-label">Incoming Webhook Url</label> <label for="WebhookUrl" class="control-label">Incoming Webhook Url</label>
<small class="control-label">This is the full webhook url.</small> <small class="control-label">This is the full webhook url.</small>
<small class="control-label"> Mattermost > Settings > Add app or integration > Build > Make a Custom Integration > Incoming Webhooks > Add Incoming Webhook. You will then have a Webhook Url</small> <small class="control-label"> Mattermost > Integrations > Incoming Webhook > Add Incoming Webhook. You will then have a Webhook Url</small>
<div class=""> <div class="">
<input type="text" class="form-control form-control-custom " id="WebhookUrl" name="WebhookUrl" value="@Model.WebhookUrl"> <input type="text" class="form-control form-control-custom " id="WebhookUrl" name="WebhookUrl" value="@Model.WebhookUrl">
</div> </div>
@ -46,6 +46,14 @@
</div> </div>
</div> </div>
<div class="form-group">
<label for="IconUrl" class="control-label">Icon Override</label>
<small class="control-label">You can override the default icon here</small>
<div class="">
<input type="text" class="form-control form-control-custom " id="IconUrl" name="IconUrl" value="@Model.IconUrl">
</div>
</div>
<div class="form-group"> <div class="form-group">
<div> <div>
<button id="testMattermost" type="submit" class="btn btn-primary-outline">Test <div id="spinner"></div></button> <button id="testMattermost" type="submit" class="btn btn-primary-outline">Test <div id="spinner"></div></button>