---
title: NotificationsApi
---
## PureCloud::NotificationsApi
All URIs are relative to *https://api.mypurecloud.com*
Method | Description
------------- | ------------- | -------------
[**delete_channels_channel_id_subscriptions**](NotificationsApi.html#delete_channels_channel_id_subscriptions) | Remove all subscriptions
[**get_availabletopics**](NotificationsApi.html#get_availabletopics) | Get available notification topics.
[**get_channels**](NotificationsApi.html#get_channels) | The list of existing channels
[**get_channels_channel_id_subscriptions**](NotificationsApi.html#get_channels_channel_id_subscriptions) | The list of all subscriptions for this channel
[**post_channels**](NotificationsApi.html#post_channels) | Create a new channel
[**post_channels_channel_id_subscriptions**](NotificationsApi.html#post_channels_channel_id_subscriptions) | Add a list of subscriptions to the existing list of subscriptions
[**put_channels_channel_id_subscriptions**](NotificationsApi.html#put_channels_channel_id_subscriptions) | Replace the current list of subscriptions with a new list.
{: class="table table-striped"}
## -String** delete_channels_channel_id_subscriptions(channel_id)
Remove all subscriptions
Wraps DELETE /api/v2/notifications/channels/{channelId}/subscriptions
### Example
~~~ruby
# load the gem
require 'purecloud'
# setup authorization
@secret = ENV['PURECLOUD_SECRET']
@id = ENV['PURECLOUD_CLIENT_ID']
environment = "mypurecloud.com"
@authToken = PureCloud.authenticate_with_client_credentials @id, @secret, environment
PureCloud.configure do |config|
config.access_token = @authToken
end
api_instance = PureCloud::NotificationsApi.new
channel_id = "channel_id_example" # String | Channel ID
begin
#Remove all subscriptions
result = api_instance.delete_channels_channel_id_subscriptions(channel_id)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling NotificationsApi->delete_channels_channel_id_subscriptions: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**channel_id** | **String**| Channel ID |
{: class="table table-striped"}
### Return type
**String**
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**AvailableTopicEntityListing**](AvailableTopicEntityListing.html) get_availabletopics(opts)
Get available notification topics.
Wraps GET /api/v2/notifications/availabletopics
### Example
~~~ruby
# load the gem
require 'purecloud'
# setup authorization
@secret = ENV['PURECLOUD_SECRET']
@id = ENV['PURECLOUD_CLIENT_ID']
environment = "mypurecloud.com"
@authToken = PureCloud.authenticate_with_client_credentials @id, @secret, environment
PureCloud.configure do |config|
config.access_token = @authToken
end
api_instance = PureCloud::NotificationsApi.new
opts = {
expand: ["expand_example"] # Array | Which fields, if any, to expand
}
begin
#Get available notification topics.
result = api_instance.get_availabletopics(opts)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling NotificationsApi->get_availabletopics: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**expand** | [**Array<String>**](String.html)| Which fields, if any, to expand | [optional]
{: class="table table-striped"}
### Return type
[**AvailableTopicEntityListing**](AvailableTopicEntityListing.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**ChannelEntityListing**](ChannelEntityListing.html) get_channels
The list of existing channels
Wraps GET /api/v2/notifications/channels
### Example
~~~ruby
# load the gem
require 'purecloud'
# setup authorization
@secret = ENV['PURECLOUD_SECRET']
@id = ENV['PURECLOUD_CLIENT_ID']
environment = "mypurecloud.com"
@authToken = PureCloud.authenticate_with_client_credentials @id, @secret, environment
PureCloud.configure do |config|
config.access_token = @authToken
end
api_instance = PureCloud::NotificationsApi.new
begin
#The list of existing channels
result = api_instance.get_channels
p result
rescue PureCloud::ApiError => e
puts "Exception when calling NotificationsApi->get_channels: #{e}"
end
~~~
### Parameters
This endpoint does not need any parameter.
{: class="table table-striped"}
### Return type
[**ChannelEntityListing**](ChannelEntityListing.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**ChannelTopicEntityListing**](ChannelTopicEntityListing.html) get_channels_channel_id_subscriptions(channel_id)
The list of all subscriptions for this channel
Wraps GET /api/v2/notifications/channels/{channelId}/subscriptions
### Example
~~~ruby
# load the gem
require 'purecloud'
# setup authorization
@secret = ENV['PURECLOUD_SECRET']
@id = ENV['PURECLOUD_CLIENT_ID']
environment = "mypurecloud.com"
@authToken = PureCloud.authenticate_with_client_credentials @id, @secret, environment
PureCloud.configure do |config|
config.access_token = @authToken
end
api_instance = PureCloud::NotificationsApi.new
channel_id = "channel_id_example" # String | Channel ID
begin
#The list of all subscriptions for this channel
result = api_instance.get_channels_channel_id_subscriptions(channel_id)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling NotificationsApi->get_channels_channel_id_subscriptions: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**channel_id** | **String**| Channel ID |
{: class="table table-striped"}
### Return type
[**ChannelTopicEntityListing**](ChannelTopicEntityListing.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**Channel**](Channel.html) post_channels
Create a new channel
There is a limit of 10 channels. Creating an 11th channel will remove the channel with oldest last used date.
Wraps POST /api/v2/notifications/channels
### Example
~~~ruby
# load the gem
require 'purecloud'
# setup authorization
@secret = ENV['PURECLOUD_SECRET']
@id = ENV['PURECLOUD_CLIENT_ID']
environment = "mypurecloud.com"
@authToken = PureCloud.authenticate_with_client_credentials @id, @secret, environment
PureCloud.configure do |config|
config.access_token = @authToken
end
api_instance = PureCloud::NotificationsApi.new
begin
#Create a new channel
result = api_instance.post_channels
p result
rescue PureCloud::ApiError => e
puts "Exception when calling NotificationsApi->post_channels: #{e}"
end
~~~
### Parameters
This endpoint does not need any parameter.
{: class="table table-striped"}
### Return type
[**Channel**](Channel.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**ChannelTopicEntityListing**](ChannelTopicEntityListing.html) post_channels_channel_id_subscriptions(channel_id, body)
Add a list of subscriptions to the existing list of subscriptions
Wraps POST /api/v2/notifications/channels/{channelId}/subscriptions
### Example
~~~ruby
# load the gem
require 'purecloud'
# setup authorization
@secret = ENV['PURECLOUD_SECRET']
@id = ENV['PURECLOUD_CLIENT_ID']
environment = "mypurecloud.com"
@authToken = PureCloud.authenticate_with_client_credentials @id, @secret, environment
PureCloud.configure do |config|
config.access_token = @authToken
end
api_instance = PureCloud::NotificationsApi.new
channel_id = "channel_id_example" # String | Channel ID
body = [PureCloud::ChannelTopic.new] # Array | Topic
begin
#Add a list of subscriptions to the existing list of subscriptions
result = api_instance.post_channels_channel_id_subscriptions(channel_id, body)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling NotificationsApi->post_channels_channel_id_subscriptions: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**channel_id** | **String**| Channel ID |
**body** | [**Array<ChannelTopic>**](ChannelTopic.html)| Topic |
{: class="table table-striped"}
### Return type
[**ChannelTopicEntityListing**](ChannelTopicEntityListing.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**ChannelTopicEntityListing**](ChannelTopicEntityListing.html) put_channels_channel_id_subscriptions(channel_id, body)
Replace the current list of subscriptions with a new list.
Wraps PUT /api/v2/notifications/channels/{channelId}/subscriptions
### Example
~~~ruby
# load the gem
require 'purecloud'
# setup authorization
@secret = ENV['PURECLOUD_SECRET']
@id = ENV['PURECLOUD_CLIENT_ID']
environment = "mypurecloud.com"
@authToken = PureCloud.authenticate_with_client_credentials @id, @secret, environment
PureCloud.configure do |config|
config.access_token = @authToken
end
api_instance = PureCloud::NotificationsApi.new
channel_id = "channel_id_example" # String | Channel ID
body = [PureCloud::ChannelTopic.new] # Array | Topic
begin
#Replace the current list of subscriptions with a new list.
result = api_instance.put_channels_channel_id_subscriptions(channel_id, body)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling NotificationsApi->put_channels_channel_id_subscriptions: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**channel_id** | **String**| Channel ID |
**body** | [**Array<ChannelTopic>**](ChannelTopic.html)| Topic |
{: class="table table-striped"}
### Return type
[**ChannelTopicEntityListing**](ChannelTopicEntityListing.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json