微算力 · API 导航与自营网关
API 接入 EN
未登录登录
🔧

企业IT运维一站式自动化平台

ServiceNow · v1.0.0
效率 安全 B 级 作者 onlyflowstech 公开目录收录
1.2k 下载 0 安装 4.2k 收藏 11 浏览

简介

连接ServiceNow实现ITSM/ITOM/CMDB全流程管理,支持完整CRUD操作与聚合分析,专为企业IT运维场景设计。

原始描述

Connect your AI agent to ServiceNow — query, create, update, and manage records across any table using the Table API and Stats API. Full CRUD operations, agg...

通过你的 Agent 添加

点「快速安装」复制一段指令,粘给你正在用的 Agent(Claude Code、Codex、OpenClaw 等),它会自己完成安装。

或者手动安装

Claude Codeunzip -o skill.zip -d ~/.claude/skills/servicenow/
其它 Agent解压到它自己的 skills 目录,目录名用 servicenow

包里是 SKILL.md 加作者附带的文件,解压后目录名就是技能名。 技能申请的权限由作者决定,装之前请确认它能读什么、能执行什么。

中文使用说明 来自收录源

核心功能

ServiceNow Skill 提供对企业级IT服务管理平台 ServiceNow 的全面 API 集成能力,覆盖 ITSM(IT服务管理)、ITOM(IT运维管理)及 CMDB(配置管理数据库)三大核心领域。

主要能力

  • 完整CRUD操作:通过 Table API 对任意数据表进行查询、创建、更新、删除
  • 聚合分析:支持 COUNT/AVG/MIN/MAX/SUM 等统计运算,可按字段分组
  • Schema 自省:动态获取表结构、字段类型、必填项、选项值及引用关系
  • 附件管理:上传、下载、列示记录附件
  • 编码查询:支持 ServiceNow 原生查询语法,包括多条件组合、模糊匹配、日期范围、空值判断等

典型应用场景

  • IT工单自动化:批量查询高优先级事件、自动分派、状态流转
  • 变更管理:创建变更请求、跟踪审批流程、关联配置项
  • CMDB运维:查询服务器配置、更新资产状态、分析配置项分布
  • 知识库集成:检索知识文章、关联问题记录

显著优点

  1. 企业级覆盖:原生支持 ServiceNow 核心模块,无需额外开发适配
  2. 灵活查询:保留 ServiceNow 原生查询能力,复杂条件均可表达
  3. 安全控制:删除操作需显式确认,防止误操作
  4. 字段解析:--display 模式自动解析引用字段为可读值

潜在局限

  1. 依赖脚本层:实际调用需通过 sn.sh 封装脚本,增加一层间接性
  2. 认证方式单一:仅支持 Basic Auth,不支持 OAuth 等现代认证
  3. 无内置缓存:频繁查询可能对 ServiceNow 实例造成性能压力
  4. Rate Limit 敏感:大规模批量操作需自行控制频率

适合人群

  • 企业 IT 运维团队需自动化 ServiceNow 操作
  • 开发运维(DevOps)工程师构建工单流转自动化
  • 服务台管理员进行批量数据分析和报表生成

常规风险

  • 凭证泄露:SN_USER/SN_PASSWORD 以环境变量明文存储,需严格控制访问权限
  • 误删风险:虽需 --confirm 确认,但仍存在脚本调用时的逻辑漏洞
  • 数据一致性:并发更新场景下无乐观锁机制,可能产生覆盖冲突
  • 权限边界:ServiceNow 账户权限需精细化配置,避免越权操作

技能正文


name: servicenow emoji: 🔧 description: "Connect your AI agent to ServiceNow — query, create, update, and manage records across any table using the Table API and Stats API. Full CRUD operations, aggregate analytics (COUNT/AVG/MIN/MAX/SUM), schema introspection, and attachment management. Purpose-built for ITSM, ITOM, and CMDB workflows including incidents, changes, problems, configuration items, knowledge articles, and more." author: "OnlyFlows (onlyflowstech)" homepage: "https://onlyflows.tech" license: MIT tags:

  • servicenow
  • itsm
  • itom
  • cmdb
  • snow
  • table-api
  • incidents
  • changes
  • problems
  • configuration-items
  • knowledge-base
  • service-management metadata: { "openclaw": { "emoji": "🔧", "requires": { "bins": ["curl", "jq"], "env": ["SN_INSTANCE", "SN_USER", "SN_PASSWORD"] } } }

ServiceNow Skill

Query and manage records on any ServiceNow instance via the REST Table API.

Setup

Set environment variables for your ServiceNow instance:

export SN_INSTANCE="https://yourinstance.service-now.com"
export SN_USER="your_username"
export SN_PASSWORD="your_password"

All tools below use scripts/sn.sh which reads these env vars.

Tools

sn_query — Query any table

bash scripts/sn.sh query <table> [options]

Options:

  • --query "<encoded_query>" — ServiceNow encoded query (e.g. active=true^priority=1)
  • --fields "<field1,field2>" — Comma-separated fields to return
  • --limit <n> — Max records (default 20)
  • --offset <n> — Pagination offset
  • --orderby "<field>" — Sort field (prefix with - for descending)
  • --display <true|false|all> — Display values mode

Examples:

# List open P1 incidents
bash scripts/sn.sh query incident --query "active=true^priority=1" --fields "number,short_description,state,assigned_to" --limit 10

# All users in IT department
bash scripts/sn.sh query sys_user --query "department=IT" --fields "user_name,email,name"

# Recent change requests
bash scripts/sn.sh query change_request --query "sys_created_on>=2024-01-01" --orderby "-sys_created_on" --limit 5

sn_get — Get a single record by sys_id

bash scripts/sn.sh get <table> <sys_id> [options]

Options:

  • --fields "<field1,field2>" — Fields to return
  • --display <true|false|all> — Display values mode

Example:

bash scripts/sn.sh get incident abc123def456 --fields "number,short_description,state,assigned_to" --display true

sn_create — Create a record

bash scripts/sn.sh create <table> '<json_fields>'

Example:

bash scripts/sn.sh create incident '{"short_description":"Server down","urgency":"1","impact":"1","assignment_group":"Service Desk"}'

sn_update — Update a record

bash scripts/sn.sh update <table> <sys_id> '<json_fields>'

Example:

bash scripts/sn.sh update incident abc123def456 '{"state":"6","close_code":"Solved (Permanently)","close_notes":"Restarted service"}'

sn_delete — Delete a record

bash scripts/sn.sh delete <table> <sys_id> --confirm

The --confirm flag is required to prevent accidental deletions.

sn_aggregate — Aggregate queries

bash scripts/sn.sh aggregate <table> --type <TYPE> [options]

Types: COUNT, AVG, MIN, MAX, SUM

Options:

  • --type <TYPE> — Aggregation type (required)
  • --query "<encoded_query>" — Filter records
  • --field "<field>" — Field to aggregate on (required for AVG/MIN/MAX/SUM)
  • --group-by "<field>" — Group results by field
  • --display <true|false|all> — Display values mode

Examples:

# Count open incidents by priority
bash scripts/sn.sh aggregate incident --type COUNT --query "active=true" --group-by "priority"

# Average reassignment count
bash scripts/sn.sh aggregate incident --type AVG --field "reassignment_count" --query "active=true"

sn_schema — Get table schema

bash scripts/sn.sh schema <table> [--fields-only]

Returns field names, types, max lengths, mandatory flags, reference targets, and choice values.

Use --fields-only for a compact field list.

sn_attach — Manage attachments

# List attachments on a record
bash scripts/sn.sh attach list <table> <sys_id>

# Download an attachment
bash scripts/sn.sh attach download <attachment_sys_id> <output_path>

# Upload an attachment
bash scripts/sn.sh attach upload <table> <sys_id> <file_path> [content_type]

Common Tables

Table Description
incident Incidents
change_request Change Requests
problem Problems
sc_req_item Requested Items (RITMs)
sc_request Requests
sys_user Users
sys_user_group Groups
cmdb_ci Configuration Items
cmdb_ci_server Servers
kb_knowledge Knowledge Articles
task Tasks (parent of incident/change/problem)
sys_choice Choice list values

Encoded Query Syntax

ServiceNow encoded queries use ^ as AND, ^OR as OR:

  • active=true^priority=1 — Active AND P1
  • active=true^ORactive=false — Active OR inactive
  • short_descriptionLIKEserver — Contains "server"
  • sys_created_on>=2024-01-01 — Created after date
  • assigned_toISEMPTY — Unassigned
  • stateIN1,2,3 — State is 1, 2, or 3
  • caller_id.name=John Smith — Dot-walk through references

Notes

  • All API calls use Basic Auth via SN_USER / SN_PASSWORD
  • Default result limit is 20 records; use --limit to adjust
  • Use --display true to get human-readable values instead of sys_ids for reference fields
  • The script auto-detects whether SN_INSTANCE includes the protocol prefix

正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。

标签

servicenowitsmitomcmdbenterprise-automationrest-apiticketingincident-managementchange-managementconfiguration-management

同类 Skill