The Messaging API provides methods to perform actions in a third-party messaging application.

This class requires the Messaging Notification plugin (com.glide.notification.messaging) and an integration with a third-party messaging application such as Slack or Teams. Use these methods in an action script in the Message Actions [messaging_observer_handler] table.

Use the sn_notification namespace to access the Messaging API.

Messaging - send(GlideRecord messagingApplication, String recipient, GlideRecord messagingContent, GlideRecord target)

Sends a custom message to a third-party application in response to a messaging event. For example, you can send a custom welcome message to a Slack channel when the Now Actions application installs.

Use this method in an action script in the Message Actions [messaging_observer_handler] table.

Table 2. Returns
Type Description
void

Example

//Send a message to a Teams user
var app = new GlideRecord('messaging_application');
app.get('1f2d26527f4213007f005212bdfa9102');

var content = new GlideRecord('messaging_content');
content.get('17f1f9617320130082999cfd7bf6a706');

sn_notification.Messaging.send(app, '29:1ojsgDg1xuA_jZ70PDI2_6E7mn7P6Mc0wK7z0n2lblL-SaNXYVI1cR7i6qncllAGvdmhy2-kXh76IEVpUHXdz3w', content, null);

//Send a message to a Slack user
var app = new GlideRecord('messaging_application');
app.get('5d2e38c07f6113007f005212bdfa9160');

var content = new GlideRecord('messaging_content');
content.get('69c48ba77310130082999cfd7bf6a7af');

sn_notification.Messaging.send(app, 'U8P706QFQ', content, null);

//Send a message to a Slack channel
var app = new GlideRecord('messaging_application');
app.get('5d2e38c07f6113007f005212bdfa9160');

var content = new GlideRecord('messaging_content');
content.get('69c48ba77310130082999cfd7bf6a7af');

sn_notification.Messaging.send(app, 'CA6232N65', content, null);