mcpField
I
itsm-email-recommendation

itsm-email-recommendation

github.com/happy-technologies-llc生产力4141 次安装2 天前更新
代码仓库

关于 itsm-email-recommendation

用于 ServiceNow ITSM 案例邮件回复撰写的技能,面向需要向用户和相关方清晰沟通的 ITSM 团队。它结合案例记录、沟通历史、技术信息和知识文章,生成确认、状态更新、解决或升级邮件。

主要功能

  1. 01分析事件、变更或问题背景
  2. 02结合技术信息撰写邮件
  3. 03引用知识文章和已知解决方法
  4. 04提供后续步骤与预计时间
  5. 05生成状态及结案通知

适用场景

  1. 01向用户发送事件受理确认
  2. 02为重大事件准备状态更新
  3. 03发送含解决摘要的结案邮件

MCP 相关

该技能使用 MCP 工具读取 ServiceNow 案例、邮件历史、工作记录和知识文章,并可将推荐邮件记录为工作备注。

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/happy-technologies-llc/happy-platform-skills --skill itsm-email-recommendation

安装后在 Claude Code 中输入/itsm-email-recommendation确认已加载。

详细介绍

ITSM 邮件建议

概述

此技能提供了一套结构化方法,用于为 IT 服务管理案例生成专业的邮件回复。内容包括:

  • 分析事件、变更或问题背景,撰写有针对性的邮件回复
  • 纳入相关技术细节,同时避免让非技术收件人难以理解
  • 在回复中引用相关知识库文章和已知解决方法
  • 明确说明后续步骤和预计解决时间
  • 为正在处理的事件生成状态更新邮件
  • 创建包含解决摘要的结案通知邮件

使用场景: ITSM 代理需要就 IT 服务案例向最终用户、利益相关方或管理层发送专业、结构清晰的邮件回复时。尤其适用于需要技术说明的复杂事件,或需要更新高优先级问题状态的场景。

所需插件: com.snc.incident(事件管理)

先决条件

  • 角色: itil、incident_manager 或 admin
  • 访问权限: 对 incident、change_request、problem、kb_knowledge、sys_email 具有读取权限;对事件工作备注具有写入权限
  • 知识: 熟悉 IT 服务管理流程、SLA 要求和组织沟通规范
  • 插件: 必须激活 com.snc.incident

操作步骤

第 1 步:获取案例背景

提取完整记录,以了解问题、当前状态和利益相关方。

使用 MCP:

Tool: SN-Get-Record
Parameters:
  table_name: incident
  sys_id: [incident_sys_id]
  fields: sys_id,number,short_description,description,state,priority,impact,urgency,category,subcategory,assignment_group,assigned_to,caller_id,caller_id.name,caller_id.email,caller_id.vip,opened_at,resolved_at,close_code,close_notes,business_service,cmdb_ci,sla_due,made_sla

使用 REST API:

GET /api/now/table/incident/[incident_sys_id]?sysparm_fields=sys_id,number,short_description,description,state,priority,impact,urgency,category,subcategory,assignment_group,assigned_to,caller_id,opened_at,resolved_at,close_code,close_notes,business_service,cmdb_ci,sla_due,made_sla&sysparm_display_value=true
第 2 步:查看沟通历史

检查之前的邮件,以保持邮件往来的连贯性并避免内容重复。

使用 MCP:

Tool: SN-Query-Table
Parameters:
  table_name: sys_email
  query: instance=incident^target=[incident_sys_id]^ORDERBYDESCsys_created_on
  fields: sys_id,type,subject,body_text,recipients,sys_created_on
  limit: 10

使用 REST API:

GET /api/now/table/sys_email?sysparm_query=instance=incident^target=[incident_sys_id]^ORDERBYDESCsys_created_on&sysparm_fields=sys_id,type,subject,body_text,recipients,sys_created_on&sysparm_display_value=true&sysparm_limit=10
第 3 步:收集技术背景

查看工作备注,了解诊断结果和已采取的措施。

使用 MCP:

Tool: SN-Query-Table
Parameters:
  table_name: sys_journal_field
  query: element_id=[incident_sys_id]^name=incident^element=work_notes^ORDERBYsys_created_on
  fields: value,sys_created_by,sys_created_on
  limit: 20
第 4 步:查找相关知识文章

搜索可在邮件中引用的知识库文章。

使用 MCP:

Tool: SN-Query-Table
Parameters:
  table_name: kb_knowledge
  query: workflow_state=published^short_descriptionLIKE[keyword1]^ORtextLIKE[keyword1]
  fields: sys_id,number,short_description,text
  limit: 5
第 5 步:检查相关记录

查找相关问题、变更或已知错误,以补充背景信息。

使用 MCP:

Tool: SN-Execute-Background-Script
Parameters:
  description: Gather related records for email context
  script: |
    var incId = '[incident_sys_id]';
    var inc = new GlideRecord('incident');
    inc.get(incId);

    gs.info('=== RELATED RECORDS FOR EMAIL CONTEXT ===');

    // Related problem
    if (inc.problem_id && inc.problem_id.toString() !== '') {
      var prob = inc.problem_id.getRefRecord();
      gs.info('Problem: ' + prob.number + ' | ' + prob.short_description + ' | Workaround: ' + prob.workaround);
    }

    // Related changes
    var change = new GlideRecord('change_request');
    change.addQuery('reason', incId);
    change.query();
    while (change.next()) {
      gs.info('Change: ' + change.number + ' | ' + change.short_description + ' | State: ' + change.state.getDisplayValue() + ' | Scheduled: ' + change.start_date);
    }

    // Similar recent incidents (for pattern context)
    var similar = new GlideRecord('incident');
    similar.addQuery('category', inc.category.toString());
    similar.addQuery('state', '6'); // Resolved
    similar.addQuery('sys_id', '!=', incId);
    similar.addQuery('sys_created_on', '>=', gs.daysAgo(30));
    similar.orderByDesc('resolved_at');
    similar.setLimit(5);
    similar.query();

    gs.info('\n--- Similar Resolved Incidents ---');
    while (similar.next()) {
      gs.info(similar.number + ': ' + similar.short_description + ' | Resolution: ' + similar.close_notes.toString().substring(0, 100));
    }
第 6 步:生成邮件回复

根据案例状态选择合适的模板并撰写邮件。

模板 1:初次确认

Subject: [INC Number] - Your request has been received: [Short Description]

Dear [Caller Name],

Thank you for contacting IT Support. We have received your request and created incident [INC Number] for tracking.

Issue Summary: [Short Description]
Priority: [Priority Level]
Assigned Team: [Assignment Group]

What happens next:
- Our [Assignment Group] team will review your request within [SLA timeframe]
- You will receive updates as we investigate
- You can check the status anytime at [Service Portal URL]

If you have additional information to share, please reply to this email or update the incident through the service portal.

Best regards,
[Agent Name]
IT Service Desk
Reference: [INC Number]

模板 2:状态更新

Subject: Re: [INC Number] - Status Update: [Short Description]

Dear [Caller Name],

I wanted to provide you with an update on your incident [INC Number].

Current Status: [State]
Investigation Summary:
[Brief technical summary in plain language]

Actions Taken:
1. [Action 1]
2. [Action 2]
3. [Action 3]

Next Steps:
- [What will happen next]
- Expected timeline: [Estimated timeframe]

[If workaround available:]
In the meantime, you can use the following workaround:
[Workaround steps]

Please let us know if you have any questions or if the situation has changed.

Best regards,
[Agent Name]
IT Service Desk
Reference: [INC Number]

模板 3:解决通知

Subject: Re: [INC Number] - Resolved: [Short Description]

Dear [Caller Name],

I am pleased to let you know that your incident [INC Number] has been resolved.

Resolution Summary:
[Clear description of what was done to resolve the issue]

Root Cause:
[Brief explanation of what caused the issue, if known]

What You Should See:
[Description of expected behavior now that the issue is resolved]

Preventive Steps:
[Any recommendations to prevent recurrence]

For future reference, you may find this knowledge article helpful:
[KB Article Title] - [KB Number]

This incident will be automatically closed in [X] business days if no further issues are reported. If you experience the issue again, please reply to this email or reopen the incident through the service portal.

Best regards,
[Agent Name]
IT Service Desk
Reference: [INC Number]

模板 4:升级通知

Subject: Re: [INC Number] - Escalation Notice: [Short Description]

Dear [Caller Name],

I am writing to let you know that your incident [INC Number] has been escalated to our [Specialized Team] team for further investigation.

Reason for Escalation:
[Brief explanation of why escalation is needed]

What This Means:
- A specialist from [Team Name] will be assigned to your case
- They will have full context from our previous investigation
- You may be contacted for additional details

Updated Timeline: [New estimated timeframe]

We understand the urgency and are committed to resolving this as quickly as possible.

Best regards,
[Agent Name]
IT Service Desk
Reference: [INC Number]
第 7 步:记录并发送

将建议的邮件保存为工作备注,并可选择将其添加为客户可见的评论。

使用 MCP:

Tool: SN-Add-Work-Notes
Parameters:
  table_name: incident
  sys_id: [incident_sys_id]
  work_notes: |
    === RECOMMENDED EMAIL RESPONSE ===
    Type: [Acknowledgment/Status Update/Resolution/Escalation]
    Recipient: [Caller Name and Email]

    Subject: [Subject line]

    [Full email body]

    === REFERENCES ===
    KB Articles: [KB numbers referenced]
    Related Change: [CHG number if applicable]
    Related Problem: [PRB number if applicable]

工具用法

MCP 工具参考
工具使用场景
SN-Get-Record获取事件、变更或问题的完整背景
SN-Query-Table查询邮件历史、工作备注和相关记录
SN-Natural-Language-Search查找邮件中可引用的相关知识文章
SN-Update-Record更新事件,记录邮件通知详情
SN-Add-Work-Notes记录建议的邮件内容
SN-Execute-Background-Script收集跨记录背景信息、批量生成邮件
REST API 参考
端点方法用途
/api/now/table/incidentGET/PATCH读取事件并更新记录
/api/now/table/change_requestGET查找相关变更以补充背景信息
/api/now/table/problemGET查找相关问题和解决方法
/api/now/table/kb_knowledgeGET搜索相关知识库文章
/api/now/table/sys_emailGET查看沟通历史
/api/now/table/sys_journal_fieldGET提取工作备注以了解技术背景

最佳实践

  • 使用通俗语言: 将技术术语转换为收件人能理解的语言;技术细节留待工作备注说明
  • 具体明确: 提供事件编号、日期和具体的后续步骤,避免含糊的承诺
  • 明确预期: 始终告知预计时间,以及用户接下来可以期待什么
  • 提供自助服务指引: 引导用户查看知识库文章和服务门户,以便今后自行解决问题
  • 保持邮件往来连贯: 使用「Re:」前缀并附上事件编号,确保邮件会话连贯
  • 留意 VIP 身份: 检查来电者是否为 VIP,并相应调整语气和紧急程度表述
  • 校对语气: 确保邮件体现专业和同理心,尤其是在用户感到沮丧时

故障排除

邮件历史记录无法加载

原因: 通过外部系统发送的邮件可能未记录在 sys_email 中
解决方案: 检查 sys_journal_field 中可能包含邮件内容的评论。查看通知日志,了解投递状态。

知识库文章不匹配

原因: 搜索词过于具体,或知识库文章的分类不同
解决方案: 扩大搜索范围。尝试按类别搜索。使用 SN-Natural-Language-Search 进行语义匹配。

邮件模板不适用于当前场景

原因: 事件状态或上下文与标准模板不匹配
解决方案: 组合多个模板中的内容。根据具体情况进行自定义。始终包含:当前状态、已采取的措施和后续步骤。

收件人不明确

原因: 来电者和受影响用户可能不是同一人,或者需要向多个利益相关方发送更新
解决方案: 检查 caller_id、opened_by 和 watch_list 字段。对于重大事件,请使用重大事件流程中的分发列表。

示例

示例 1:网络中断状态更新
# 1. Get incident details
Tool: SN-Get-Record
Parameters:
  table_name: incident
  sys_id: [sys_id]
  fields: number,short_description,state,priority,caller_id.name,business_service,assignment_group

# 2. Get recent diagnostic notes
Tool: SN-Query-Table
Parameters:
  table_name: sys_journal_field
  query: element_id=[sys_id]^name=incident^element=work_notes^ORDERBYDESCsys_created_on
  fields: value,sys_created_by,sys_created_on
  limit: 5

# 3. Draft status update email with technical findings in plain language
示例 2:附带知识库参考的解决邮件
# 1. Get resolution details
Tool: SN-Get-Record
Parameters:
  table_name: incident
  sys_id: [sys_id]
  fields: number,short_description,close_code,close_notes,caller_id.name

# 2. Find relevant KB article
Tool: SN-Query-Table
Parameters:
  table_name: kb_knowledge
  query: workflow_state=published^123TEXTQUERY321=[resolution topic]
  fields: number,short_description
  limit: 3
示例 3:重大事件的批量状态更新
Tool: SN-Execute-Background-Script
Parameters:
  description: Generate status update for all users affected by major incident
  script: |
    var majorInc = new GlideRecord('incident');
    majorInc.get('[major_incident_sys_id]');

    // Find all child incidents
    var child = new GlideRecord('incident');
    child.addQuery('parent_incident', majorInc.sys_id.toString());
    child.query();

    gs.info('=== MAJOR INCIDENT STATUS UPDATE ===');
    gs.info('Major Incident: ' + majorInc.number + ' | ' + majorInc.short_description);
    gs.info('Affected Users: ' + child.getRowCount());

    gs.info('\n--- RECOMMENDED BULK EMAIL ---');
    gs.info('Subject: [' + majorInc.number + '] Status Update - ' + majorInc.short_description);
    gs.info('Body: We are currently experiencing [issue description]. Our team is actively working on resolution. Current ETA: [timeframe]. We will provide the next update by [time].');

相关技能

  • itsm/chat-reply-recommendation - 基于聊天的回复建议
  • itsm/incident-summarization - 总结事件,为邮件提供上下文
  • itsm/kb-generation - 创建邮件中引用的知识库文章
  • hrsd/email-recommendation - HR 专用邮件建议
  • itsm/major-incident - 重大事件沟通工作流

参考资料

评论

支持 Markdown