ServiceNow CSM
ServiceNow Customer Service Management を Squid に接続して、case の検索、作成、管理を行う
ServiceNow CSM connector の機能
ServiceNow CSM connector により、Squid AI agent はユーザーに代わって Customer Service Management cases を操作できます。
| 機能 | 説明 |
|---|---|
| case の検索 | short description、description、または case number による case のテキスト検索。必要に応じて state で絞り込み |
| case 詳細の取得 | caller、assignee、comments、work notes を含む完全な case 詳細 |
| セマンティック検索 | index 化された cases に対する自然言語検索 |
| case の作成 | short description、description、priority、category、caller を指定して新しい case を作成 |
| case への返信 | case に public comment または internal work note を追加 |
Squid は CSM cases を自動的に knowledge base に同期し、10 分ごとに更新します(初回同期では過去 1 年分の case 履歴が対象です)。これによりセマンティック検索機能が有効になります。
この connector は ServiceNow Customer Service Management cases(sn_customerservice_case table)で動作します。ITSM incidents は管理しません。
ServiceNow REST API key の作成
この connector は ServiceNow API key で認証します。API key はすべての request で x-sn-apikey header として送信されます。設定には ServiceNow で 4 つの record が必要で、4 つすべてが存在するまで key は無効なままです。
前提条件
- ServiceNow Washington DC 以降。API key authentication はそれ以前の release には存在しません。
https://YOUR_INSTANCE.service-now.com/stats.doで release を確認してください。 - API Key and HMAC Authentication plugin(
com.glide.tokenbased_auth)。All > Admin Center > Application Manager で有効化されていること。 - Customer Service Management plugin(
com.sn_customerservice)。これによりsn_customerservice_casetable が作成されます。
1. integration user を作成する
All > User Administration > Users で専用 user を作成し、sn_customerservice_agent role に加えて、case tables に対して ACL が必要とする追加の role を付与します。API key はこの user の access を継承するため、role は connector が実際に行う操作(cases、comments、work notes の読み取り)に合わせて範囲を限定してください。
2. inbound authentication profile を作成する
-
All > System Web Services > API Access Policies > Inbound Authentication Profile に移動します。
-
New をクリックし、次に Create API Key authentication profiles をクリックします。
-
profile に名前を付けます。例:
Squid API Key Profile。 -
Auth Parameter で、
x-sn-apikeyheader record を選択します。 -
Submit をクリックします。
query parameter record ではなく、header record を選択してください。この connector は key を header としてのみ送信するため、query parameter に紐づいた profile は一致しません。Auth Parameter field が空の場合、profile は無効になり、401 response が発生します。
3. REST API key を作成する
-
All > System Web Services > API Access Policies > REST API Key に移動します。
-
New をクリックし、key に名前を付け、User を手順 1 の integration user に設定します。
-
Submit をクリックし、record を再度開いて token を表示します。
-
token をコピーします。これが Squid に貼り付ける必要がある値です。
4. Table API を対象とするすべての policy に profile をアタッチする
ServiceNow は REST API Access Policies を具体性に基づいて評価し、最も具体的に一致する単一の policy のみを適用します。ほとんどの instance には Table API をすでに対象とする seeded policies が含まれているため、新しい広範な policy を作成しても通常は何も達成されません。seeded policy が優先され、作成した policy は評価されず、API key も参照されません。
-
All > System Web Services > API Access Policies > REST API Access Policies に移動します。
-
Table API request に一致する可能性があるすべての policy を特定します。REST API が Table API に設定されている policy、および Global がチェックされている policy が対象です。
-
それぞれの policy で、Authentication Profiles related list を開き、手順 2 の profile を追加します。
-
既存の authentication profiles はそのまま残します。
policy は、それにアタッチされた authentication methods のみを許可します。policy から Basic Auth または OAuth を削除すると、その API 全体でそれらの method が無効になります。
ServiceNow CSM connector を Squid application に追加する
-
Squid Console の Connectors tab に移動します。
-
Available Connectors をクリックします。
-
ServiceNow - CSM connector を見つけ、Add Connector を選択します。
-
次の configuration details を入力します。
Connector ID: code 内で connector を一意に識別する string。
Instance Domain: ServiceNow instance の subdomain。たとえば instance が https://mycompany.service-now.com にある場合は、mycompany と入力します。
REST API Token: 上で作成した API key token。この token は Squid secret として安全に保存されます。
application で ServiceNow CSM connector を使用する
No-code Studio
-
Squid Console の Studio tab に移動します。
-
Create AI Agent をクリックします。
-
agent ID と description を入力します。例: "csm-agent"、"This agent helps the user manage ServiceNow customer service cases"。
-
Add Abilities をクリックします。
-
ServiceNow - CSM entry を展開し、先ほど作成した connector を選択します。
-
agent がこの connection をどのように使用すべきかの description を入力します。例: "Call this when a user wants to manage cases or customer service tasks in ServiceNow CSM."
-
Test をクリックし、agent に "What are the open cases?" と質問してみます。
Squid SDK の使用
Squid SDK で AI agent を作成する場合は、ask() function の connectedIntegrations option に追加して connector を接続します。
- TypeScript
- Python
await this.squid
.ai()
.agent('AGENT_ID')
.ask('Summarize the most recent customer cases about billing', {
connectedIntegrations: [
{
integrationId: 'SERVICENOW_CONNECTOR_ID',
integrationType: 'servicenow_csm',
description: 'Call this connector to manage ServiceNow CSM cases',
},
],
});
await squid.ai().agent('AGENT_ID').ask(
'Summarize the most recent customer cases about billing',
options={
'connectedIntegrations': [
{
'integrationId': 'SERVICENOW_CONNECTOR_ID',
'integrationType': 'servicenow_csm',
'description': 'Call this connector to manage ServiceNow CSM cases',
}
]
},
)
npm package の使用
backend または client code から programmatic(non-agent)access を行うには、@squidcloud/servicenow_csm-client package を install します。
npm install @squidcloud/servicenow_csm-client
import { SquidServiceNowCSMClient } from '@squidcloud/servicenow_csm-client';
const servicenow = new SquidServiceNowCSMClient(squid, 'SERVICENOW_CONNECTOR_ID');
// Search and inspect cases
const cases = await servicenow.searchCases('billing');
const details = await servicenow.getCase(cases[0].number);
// Create a case and reply to it
const created = await servicenow.createCase({ shortDescription: 'Billing discrepancy' });
await servicenow.replyToCase(created.number, 'We are investigating.', true);
ServiceNow は priority(1 = Critical から 5 = Planning)および case state(1 = New、2 = In Progress、3 = On Hold、6 = Resolved、7 = Closed、8 = Canceled)に numeric codes を使用します。