Messaging channels¶
Messaging channels define how to send notifications, for example by email or Slack. The Agent Management client creates and retrieves the shared messaging channel handles on its instance.
In the following examples, client is an AgentManagementClient created as described in The main AgentManagementClient class. Channel creation and administration require instance administration rights.
Listing channels¶
for item in client.list_messaging_channels():
print(item.id, item.type, item.family)
mail_channels = client.list_messaging_channels(
as_type="objects", channel_family="mail"
)
Creating an SMTP channel¶
Use the creator to configure the channel before saving it. Replace the example server, sender, and credentials with your SMTP configuration.
import getpass
creator = client.new_messaging_channel("smtp")
creator.with_id("agent-notifications")
creator.with_sender("[email protected]")
creator.with_authorized_domains(["example.com"])
creator.with_host("smtp.example.com")
creator.with_port(587)
creator.with_tls(True)
creator.with_login("smtp-user")
creator.with_password(getpass.getpass("SMTP password: "))
creator.with_permissions(authorized_groups=["agent-operators"], authorized_users=[])
channel = creator.create()
Creation saves the channel configuration. It does not send a notification or attach the channel to an alert configuration. Other supported types include aws-ses-mail, microsoft-graph-mail, slack, msft-teams, and google-chat.
Retrieving settings and permissions¶
channel = client.get_messaging_channel("agent-notifications")
settings = channel.get_settings()
permissions = channel.get_permissions()
print(permissions)
Use settings.get_raw()
and settings.save()
to change the channel settings.
Use channel.set_permissions()
to change access. For the configuration and permission formats, see Messaging channels.
Deleting a channel¶
client.get_messaging_channel("unused-channel").delete()
Reference documentation¶
Classes¶
|
A handle to interact with a messaging channel on the DSS instance. |
|
Helper to create new messaging channels. |
|
Helper to create new SMTP messaging channels |
Functions¶
|
Creates the new messaging channel, and return a handle to interact with it. |
|
Deletes this messaging channel. |
|
Get the messaging channel with the corresponding ID |
Get the permissions attached to this channel |
|
|
Get the messaging channel settings. |
Returns the settings of this messaging channel as a |
|
|
List all available messaging channels |
|
Initializes the creation of a new messaging channel. |
|
Save the changes to the settings on the messaging channel. |
|
Sets the permissions on this channel |
|
Add authorized domains to the messaging-channel-to-be-created. |
|
Add a host to the messaging-channel-to-be-created. |
|
Add an ID to the messaging-channel-to-be-created. |
|
Add a login to the messaging-channel-to-be-created. |
|
Add a password to the messaging-channel-to-be-created. |
|
Replace the permission configuration for this channel. |
|
Add a port to the messaging-channel-to-be-created. |
|
Add a sender to the messaging-channel-to-be-created. |
|
Add TLS option to the messaging-channel-to-be-created. |
