-
Notifications
You must be signed in to change notification settings - Fork 0
Notification
Erik Hennerfors edited this page Aug 13, 2022
·
11 revisions
Manage notification lists.
public class SomeClass
{
private readonly NotificationClient _client;
public SomeClass()
{
_client = new NotificationClient("apiKey");
}
public void SomeMethod()
{
# Find all notification templates
_client.Find();
# Find all notification templates asynchronous
await _client.FindAsync();
# Get a notification templates
_client.Get("name");
# Get a notification templates asynchronous
await _client.GetAsync("name");
# Create a notification template
_client.Create(request);
# Create a notification template asynchronous
await _client.CreateAsync(request);
# Update a notification template
_client.Update(request);
# Update a notification template asynchronous
await _client.UpdateAsync(request);
# Delete a notification template
_client.Delete(request);
# Delete a notification template asynchronous
await _client.DeleteAsync(request);
}
}
Where and how you wish to be contacted when alerting is triggered. The
Notifications
following key/value pairs are all options and at least one of which must not be empty.
var request = new CreateRequest("name", "key", new Notifications
{
Emails = new List<string> { "john.doe@bogus.tld", "jane.doe@bogus.tld" }
});
_client.Create(request);
You can also run this method asynchronously
await _client.CreateAsync(request);
Where and how you wish to be contacted when alerting is triggered. The
Notifications
following key/value pairs are all options and at least one of which must not be empty.
var template = new Template
{
Notifications = new Notifications
{
Emails = new List<string> { "jane.doe@bogus.tld" }
}
};
var request = new UpdateRequest( "key", template);
_client.Update(request);
You can also run this method asynchronously
await _client.UpdateAsync(request);
_client.Delete("key");
You can also run this method asynchronously
await _client.DeleteAsync(request);
Where and how you wish to be contacted when alerting is triggered. The following key/value pairs are all options, at least one of which must not be empty.
new Notifications
{
Emails = new List<string>
{
"john.doe@bogus.tld", "jane.doe@bogus.tld"
},
Hipchat = new List<string>
{
"{webhook}"
},
MicrosoftTeams = new List<string>
{
"{webhook}"
},
Opsgenie = new List<string>
{
"{webhook}"
},
Pagerduty = new List<string>
{
"{key}"
},
Phones = new List<string>
{
"+1 NXX-NXX-XXXX"
},
Slack = new List<string>
{
"{webhook}"
},
Telegram = new List<string>
{
"{webhook}"
},
Victorops = new List<string>
{
"{webhook}"
},
Webhooks = new List<string>
{
"{webhook}"
}
};