Back to list
groeimetai

email-notifications

by groeimetai

🤖 AI-powered ServiceNow development with 400+ MCP tools. Works with Claude, GPT, Gemini, Ollama & 75+ providers. Deploy widgets, manage incidents, automate workflows - all through natural language. Open-source Build Agent alternative.

42🍴 9📅 Jan 23, 2026

SKILL.md


name: "email-notifications" description: "Comprehensive guide for ServiceNow email notifications (sysevent_email_action), email templates, and inbound email actions. Use when creating, managing, or troubleshooting email notifications, configuring notification triggers, setting up recipients, or working with email templates." license: "MIT" compatibility: "Snow-Flow 3.4+, ServiceNow Quebec+" triggers:

  • "email notification"
  • "notification"
  • "sysevent_email_action"
  • "email template"
  • "send email"
  • "notify"
  • "alert"
  • "inbound email"
  • "recipient"
  • "mail"
  • "digest"
  • "subscription" priority: 85 metadata: author: "Snow-Flow Team" version: "1.0.0" category: "notifications" servicenow_tables:
    • "sysevent_email_action"
    • "sysevent_email_template"
    • "sys_email"
    • "cmn_notif_message"
    • "cmn_notif_device" allowed-tools: "snow_email_notification_manage snow_create_email_template snow_send_email snow_inbound_email_action snow_query_table"

Email Notifications Skill

This skill provides comprehensive guidance for managing ServiceNow email notifications, templates, and inbound email actions.


1. Email Notification Fundamentals

Understanding sysevent_email_action

Email notifications in ServiceNow are stored in the sysevent_email_action table. They define:

  • WHEN to send (triggers, conditions)
  • WHO receives it (recipients)
  • WHAT to send (content, template)
  • HOW to send it (type, options)

Notification Types

TypeDescriptionUse Case
emailStandard email notificationMost common, formal communications
smsSMS text messageUrgent alerts, on-call notifications
pushMobile push notificationReal-time alerts for mobile users

2. Creating Email Notifications

Using the MCP Tool

// Create a notification that triggers on incident assignment
await snow_email_notification_manage({
  action: "create",
  name: "INC - Incident Assigned (Assignee)",
  table: "incident",

  // Trigger conditions
  action_update: true,  // Trigger on UPDATE
  condition: "assigned_toCHANGES^assigned_toISNOTEMPTY",

  // Recipients
  recipient_fields: ["assigned_to"],

  // Email content
  subject: "Incident ${number} has been assigned to you",
  message_html: `
    <p>Hello ${assigned_to.name},</p>
    <p>Incident <b>${number}</b> has been assigned to you.</p>
    <p><b>Short Description:</b> ${short_description}</p>
    <p><b>Priority:</b> ${priority}</p>
    <p><a href="${URI_REF}">View Incident</a></p>
  `,
  content_type: "text/html",

  // Settings
  active: true
});

Trigger Options

TriggerFieldDescription
On Insertaction_insert: trueWhen record is created
On Updateaction_update: trueWhen record is modified
On Eventevent_name: "incident.assigned"When specific event fires
Conditioncondition: "priority=1"Encoded query filter
Advancedadvanced_condition: "script"JavaScript condition (ES5!)

Recipient Options

Recipient TypeFieldExample
Field Referencerecipient_fields["assigned_to", "caller_id"]
Groupsrecipient_groups["IT Support", "Network Team"]
Usersrecipient_users["admin", "john.doe"]
Event Parameterevent_parm_1: trueUses event.parm1 as recipient
Send to Selfsend_self: trueInclude user who triggered

3. Email Templates

When to Use Templates

  • Reusability: Same content across multiple notifications
  • Consistency: Standardized branding and layout
  • Maintenance: Update once, applies everywhere
  • Complex HTML: Professional email designs

Creating Email Templates

// Create a reusable email template
await snow_create_email_template({
  name: "Incident Assignment Template",
  subject: "Incident ${number} - ${short_description}",
  message_html: `
    <!DOCTYPE html>
    <html>
    <head>
      <style>
        .header { background: #0073e6; color: white; padding: 20px; }
        .content { padding: 20px; }
        .footer { background: #f5f5f5; padding: 10px; font-size: 12px; }
      </style>
    </head>
    <body>
      <div class="header">
        <h1>IT Service Desk</h1>
      </div>
      <div class="content">
        <p>Hello ${assigned_to.name},</p>
        <p>The following incident has been assigned to you:</p>
        <table>
          <tr><td><b>Number:</b></td><td>${number}</td></tr>
          <tr><td><b>Description:</b></td><td>${short_description}</td></tr>
          <tr><td><b>Priority:</b></td><td>${priority}</td></tr>
          <tr><td><b>Category:</b></td><td>${category}</td></tr>
        </table>
        <p><a href="${URI_REF}">View Incident</a></p>
      </div>
      <div class="footer">
        <p>This is an automated message from ServiceNow.</p>
      </div>
    </body>
    </html>
  `,
  table: "incident"
});

Linking Template to Notification

// Create notification that uses the template
await snow_email_notification_manage({
  action: "create",
  name: "INC - Assignment (Template)",
  table: "incident",
  action_update: true,
  condition: "assigned_toCHANGES",
  recipient_fields: ["assigned_to"],
  template: "Incident Assignment Template",  // Reference by name
  active: true
});

4. Variable Substitution

Standard Variables

Variables are substituted using ${field_name} syntax:

VariableDescriptionExample Output
${number}Record numberINC0012345
${short_description}Short descriptionServer down
${assigned_to}sys_idabc123...
${assigned_to.name}Display valueJohn Doe
${URI_REF}Record URLhttps://instance.service-now.com/incident.do?...
${URI}Relative URLincident.do?sys_id=...
${instance_name}Instance namedev12345

Reference Field Dot-Walking

Access related record fields:

${caller_id.email}           → Caller's email
${assigned_to.manager.name}  → Assignee's manager name
${assignment_group.manager}  → Group manager

Date Formatting

${sys_created_on}                    → 2026-01-12 15:30:00
${GlideDateTime:sys_created_on}      → January 12, 2026

5. Advanced Notification Features

Digest Notifications

Combine multiple notifications into a single email:

await snow_email_notification_manage({
  action: "create",
  name: "Daily Incident Summary",
  table: "incident",
  action_insert: true,

  // Enable digest
  digestable: true,
  default_digest: true,
  digest_type: "digest",

  recipient_fields: ["assigned_to"],
  subject: "Daily Incident Summary",
  active: true
});

Force Delivery

Bypass user notification preferences:

await snow_email_notification_manage({
  action: "update",
  notification_id: "INC - Critical Alert",
  force_delivery: true,  // Always send, even if user disabled notifications
  mandatory: true        // Cannot be unsubscribed
});

Include Attachments

await snow_email_notification_manage({
  action: "create",
  name: "INC - With Attachments",
  table: "incident",
  include_attachments: true,  // Attach record's files
  // ...
});

6. Notification Conditions

Encoded Query Conditions

Common patterns for the condition field:

ScenarioEncoded Query
Priority 1 onlypriority=1
Assignment changedassigned_toCHANGES
Assigned to someoneassigned_toISNOTEMPTY
State changed to ResolvedstateCHANGESTO6
VIP callercaller_id.vip=true
Multiple conditionspriority=1^assigned_toCHANGES

Advanced Condition Scripts (ES5!)

// Advanced condition (JavaScript - ES5 ONLY!)
// Returns true to send, false to skip

// Example: Only send during business hours
var now = new GlideDateTime();
var hour = now.getLocalTime().getHour();
if (hour >= 9 && hour <= 17) {
    return true;  // Send notification
}
return false;  // Skip notification

// Example: Only send for specific categories
var validCategories = ['network', 'hardware', 'software'];
var category = current.getValue('category');
for (var i = 0; i < validCategories.length; i++) {
    if (category === validCategories[i]) {
        return true;
    }
}
return false;

7. Common Notification Patterns

Pattern 1: Assignment Notification

await snow_email_notification_manage({
  action: "create",
  name: "INC - Assigned to User",
  table: "incident",
  action_update: true,
  condition: "assigned_toCHANGES^assigned_toISNOTEMPTY",
  recipient_fields: ["assigned_to"],
  subject: "Incident ${number} assigned to you",
  message_html: "<p>Incident ${number} has been assigned to you.</p>",
  active: true
});

Pattern 2: SLA Breach Warning

await snow_email_notification_manage({
  action: "create",
  name: "INC - SLA Breach Warning",
  table: "incident",
  event_name: "sla.breach.warning",
  event_parm_1: true,  // Use event.parm1 (the SLA record)
  recipient_fields: ["assigned_to"],
  recipient_groups: ["IT Managers"],
  subject: "SLA Breach Warning: ${number}",
  importance: "high",
  force_delivery: true,
  active: true
});

Pattern 3: Caller Update Notification

await snow_email_notification_manage({
  action: "create",
  name: "INC - Status Update for Caller",
  table: "incident",
  action_update: true,
  condition: "stateCHANGES^caller_idISNOTEMPTY",
  recipient_fields: ["caller_id"],
  send_self: false,  // Don't send to person making update
  subject: "Update on your incident ${number}",
  message_html: `
    <p>Your incident has been updated:</p>
    <p><b>Status:</b> ${state}</p>
    <p><b>Comments:</b> ${work_notes.getDisplayValue()}</p>
  `,
  active: true
});

Pattern 4: Group Manager Escalation

await snow_email_notification_manage({
  action: "create",
  name: "INC - Escalation to Manager",
  table: "incident",
  action_update: true,
  condition: "priorityCHANGESTO1",  // Escalated to P1
  recipient_fields: ["assignment_group.manager"],
  recipient_groups: ["IT Directors"],
  subject: "P1 Escalation: ${number}",
  importance: "high",
  force_delivery: true,
  active: true
});

8. Managing Notifications

List All Notifications for a Table

await snow_email_notification_manage({
  action: "list",
  table: "incident",
  active_only: true,
  limit: 100
});

Get Notification Details

await snow_email_notification_manage({
  action: "get",
  notification_id: "INC - Assigned to User"  // By name
});

Enable/Disable Notifications

// Disable a notification
await snow_email_notification_manage({
  action: "disable",
  notification_id: "INC - Assigned to User"
});

// Enable a notification
await snow_email_notification_manage({
  action: "enable",
  notification_id: "INC - Assigned to User"
});

Clone a Notification

await snow_email_notification_manage({
  action: "clone",
  notification_id: "INC - Assigned to User",
  new_name: "CHG - Assigned to User",
  active: false  // Clone as inactive
});

// Then update for the new table
await snow_email_notification_manage({
  action: "update",
  notification_id: "CHG - Assigned to User",
  table: "change_request"
});

9. Troubleshooting

Common Issues

IssueCauseSolution
Notification not sendingNotification inactiveaction: "enable"
Notification not sendingCondition not metCheck encoded query
Wrong recipientsRecipient field emptyAdd fallback recipients
Missing variablesInvalid field referenceCheck field names and dot-walking
HTML not renderingWrong content_typeSet content_type: "text/html"

Check Email Logs

// Query email logs for a specific record
await snow_query_table({
  table: "sys_email",
  query: "instance=incident.abc123def",
  fields: "sys_id,recipients,subject,mailbox,type,state",
  limit: 10
});

Test a Notification

await snow_email_notification_manage({
  action: "test",
  notification_id: "INC - Assigned to User"
});
// Returns test instructions and tips

10. Best Practices

Naming Convention

Use consistent naming for notifications:

[TABLE PREFIX] - [Action/Trigger] ([Recipient])

Examples:
INC - Created (Caller)
INC - Assigned (Assignee)
INC - Resolved (Caller)
INC - SLA Breach (Manager)
CHG - Approval Required (Approver)

Performance Considerations

  1. Use conditions wisely - Don't send notifications for every update
  2. Limit recipients - Avoid sending to large groups unnecessarily
  3. Use digests - Combine frequent notifications
  4. Avoid heavy scripts - Keep advanced conditions simple (ES5!)

Security

  1. Sensitive data - Don't include passwords or tokens in emails
  2. External recipients - Validate email addresses
  3. PII - Be careful with personal information

Summary

Key Tools:

  • snow_email_notification_manage - CRUD for notifications
  • snow_create_email_template - Create reusable templates
  • snow_send_email - Send ad-hoc emails

Remember:

  1. Always set action_insert OR action_update OR event_name for triggers
  2. Define recipients via recipient_fields, recipient_groups, or recipient_users
  3. Use templates for complex, reusable email designs
  4. Advanced conditions must use ES5 JavaScript
  5. Test notifications before activating in production

Score

Total Score

75/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

+10
人気

GitHub Stars 100以上

0/15
最近の活動

1ヶ月以内に更新

+10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

+5

Reviews

💬

Reviews coming soon