Gong
Access Gong conversation intelligence - calls, transcripts, users, and analytics.
Setup
Store credentials in ~/.config/gong/credentials.json:
CODEBLOCK0
Get credentials from Gong: Settings → Ecosystem → API → Create API Key.
Authentication
CODEBLOCK1
Core Operations
List Users
CODEBLOCK2
List Calls (with date range)
CODEBLOCK3
Get Call Transcript
CODEBLOCK4
Get Call Details
CODEBLOCK5
Activity Stats
CODEBLOCK6
Endpoints Reference
| Endpoint | Method | Use |
|---|
| INLINECODE1 | GET | List users |
| INLINECODE2 |
POST | List/filter calls |
|
/v2/calls/transcript | POST | Get transcripts |
|
/v2/stats/activity/aggregate | POST | Activity stats |
|
/v2/meetings | GET | Scheduled meetings |
Pagination
Responses include cursor for pagination:
CODEBLOCK7
Include cursor in next request: INLINECODE6
Date Helpers
CODEBLOCK8
Notes
- - Rate limit: ~3 requests/second
- Call IDs are large integers as strings
- Transcripts may take time to process after call ends
- Date format: ISO 8601 (e.g.,
2025-01-15T00:00:00Z)
Gong
访问Gong对话智能平台——通话、转录文本、用户及分析数据。
配置
将凭证信息存储至 ~/.config/gong/credentials.json:
json
{
base_url: https://us-XXXXX.api.gong.io,
accesskey: YOURACCESS_KEY,
secretkey: YOURSECRET_KEY
}
从Gong获取凭证:设置 → 生态系统 → API → 创建API密钥。
身份认证
bash
GONG_CREDS=~/.config/gong/credentials.json
GONGBASE=$(jq -r .baseurl $GONG_CREDS)
GONGAUTH=$(jq -r \(.accesskey):\(.secretkey) $GONGCREDS | base64)
curl -s $GONG_BASE/v2/endpoint \
-H Authorization: Basic $GONG_AUTH \
-H Content-Type: application/json
核心操作
列出用户
bash
curl -s $GONG
BASE/v2/users -H Authorization: Basic $GONGAUTH | \
jq [.users[] | {id, email: .emailAddress, name: \(.firstName) \(.lastName)}]
列出通话(含日期范围)
bash
curl -s -X POST $GONG_BASE/v2/calls/extensive \
-H Authorization: Basic $GONG_AUTH \
-H Content-Type: application/json \
-d {
filter: {
fromDateTime: 2025-01-01T00:00:00Z,
toDateTime: 2025-01-31T23:59:59Z
},
contentSelector: {}
} | jq {
total: .records.totalRecords,
calls: [.calls[] | {
id: .metaData.id,
title: .metaData.title,
started: .metaData.started,
duration_min: ((.metaData.duration // 0) / 60 | floor),
url: .metaData.url
}]
}
获取通话转录文本
bash
curl -s -X POST $GONG_BASE/v2/calls/transcript \
-H Authorization: Basic $GONG_AUTH \
-H Content-Type: application/json \
-d {filter: {callIds: [CALL_ID]}} | \
jq .callTranscripts[0].transcript[] | \(.speakerName // Speaker): \(.sentences[].text) -r
获取通话详情
bash
curl -s -X POST $GONG_BASE/v2/calls/extensive \
-H Authorization: Basic $GONG_AUTH \
-H Content-Type: application/json \
-d {
filter: {callIds: [CALL_ID]},
contentSelector: {exposedFields: {content: true, parties: true}}
} | jq .calls[0]
活动统计
bash
curl -s -X POST $GONG_BASE/v2/stats/activity/aggregate \
-H Authorization: Basic $GONG_AUTH \
-H Content-Type: application/json \
-d {
filter: {
fromDateTime: 2025-01-01T00:00:00Z,
toDateTime: 2025-01-31T23:59:59Z
}
}
接口端点参考
| 端点 | 方法 | 用途 |
|---|
| /v2/users | GET | 列出用户 |
| /v2/calls/extensive |
POST | 列出/筛选通话 |
| /v2/calls/transcript | POST | 获取转录文本 |
| /v2/stats/activity/aggregate | POST | 活动统计 |
| /v2/meetings | GET | 已安排的会议 |
分页
响应中包含用于分页的游标:
json
{records: {totalRecords: 233, cursor: eyJ...}}
在下次请求中包含游标:{cursor: eyJ...}
日期辅助工具
bash
最近7天
FROM=$(date -v-7d +%Y-%m-%dT00:00:00Z 2>/dev/null || date -d 7 days ago +%Y-%m-%dT00:00:00Z)
TO=$(date +%Y-%m-%dT23:59:59Z)
注意事项
- - 速率限制:约3次请求/秒
- 通话ID为字符串形式的大整数
- 通话结束后转录文本可能需要时间处理
- 日期格式:ISO 8601(例如 2025-01-15T00:00:00Z)