sinch-sdks
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSinch SDKs
Sinch SDK
Overview
概述
Cross-cutting skill that covers SDK installation and client initialization for all Sinch products. Determines the correct SDK and provides init code per language.
For authentication setup (credentials, OAuth2, Basic auth, signed requests), see sinch-authentication. For In-App Calling SDKs (Browser, iOS, Android), see sinch-in-app-calling.
这是一项跨领域技能,涵盖所有Sinch产品的SDK安装与客户端初始化操作。可根据语言确定合适的SDK并提供对应的初始化代码。
如需了解认证设置(凭证、OAuth2、基础认证、签名请求),请查看sinch-authentication。如需了解应用内通话SDK(浏览器、iOS、Android),请查看sinch-in-app-calling。
Agent Instructions
Agent操作指引
If the user hasn't specified which language or platform, ask first — the SDK and init pattern differ by language. Use the table below to route to the correct reference.
如果用户未指定语言或平台,请先询问——不同语言对应的SDK和初始化模式有所不同。请使用下方表格跳转至正确的参考文档。
SDK Installation
SDK安装
| Language | Package | Install | Auth Scope |
|---|---|---|---|
| Node.js | | | Project + Application |
| Python | | | Project + Application |
| Java | | Maven dependency | Project + Application |
| .NET | | NuGet package | Project + Application |
In-App Calling uses a separate client-side SDK — not . See sinch-in-app-calling.
@sinch/sdk-core| 语言 | 包名 | 安装命令 | 认证范围 |
|---|---|---|---|
| Node.js | | | 项目 + 应用 |
| Python | | | 项目 + 应用 |
| Java | | Maven依赖 | 项目 + 应用 |
| .NET | | NuGet包 | 项目 + 应用 |
应用内通话使用独立的客户端SDK——并非。请查看sinch-in-app-calling。
@sinch/sdk-coreProduct Coverage by SDK
SDK支持的产品
Not all products are available in all SDKs. Check the table before recommending an SDK for a specific product.
| Product | Node.js | Java | .NET | Python |
|---|---|---|---|---|
| Conversation API | ✅ | ✅ | ⚠️ | ⚠️ |
| Voice API | ✅ | ✅ | ✅ | ✅ |
| Verification API | ✅ | ✅ | ✅ | ✅ |
| Numbers API | ✅ | ✅ | ✅ | ✅ |
| Number Lookup API | ✅ | ❌ | ❌ | ✅ |
| Elastic SIP Trunking | ✅ | ❌ | ❌ | ❌ |
| Fax API | ✅ | ❌ | ⚠️ | ❌ |
| Provisioning API | ✅ | ❌ | ❌ | ❌ |
| 10DLC Registration | ❌ | ❌ | ❌ | ❌ |
✅ = supported, ⚠️ = partial/preview, ❌ = not available (use direct HTTP)
When a product is not supported in the user's chosen SDK, guide them to use direct HTTP calls instead.
并非所有产品都支持所有SDK。在为特定产品推荐SDK前,请先查看下表。
| 产品 | Node.js | Java | .NET | Python |
|---|---|---|---|---|
| Conversation API | ✅ | ✅ | ⚠️ | ⚠️ |
| Voice API | ✅ | ✅ | ✅ | ✅ |
| Verification API | ✅ | ✅ | ✅ | ✅ |
| Numbers API | ✅ | ✅ | ✅ | ✅ |
| Number Lookup API | ✅ | ❌ | ❌ | ✅ |
| Elastic SIP Trunking | ✅ | ❌ | ❌ | ❌ |
| Fax API | ✅ | ❌ | ⚠️ | ❌ |
| Provisioning API | ✅ | ❌ | ❌ | ❌ |
| 10DLC注册 | ❌ | ❌ | ❌ | ❌ |
✅ = 支持,⚠️ = 部分支持/预览版,❌ = 不支持(请使用直接HTTP调用)
当用户所选SDK不支持某产品时,请引导其使用直接HTTP调用。
SDK Init References
SDK初始化参考文档
For language-specific initialization code, use the references:
- Node.js: references/sdk-init-node.md
- Python: references/sdk-init-python.md
- Java: references/sdk-init-java.md
- .NET: references/sdk-init-dotnet.md
If language is unknown, ask first. The SDKs handle token refresh automatically.
如需特定语言的初始化代码,请查看以下参考文档:
- Node.js: references/sdk-init-node.md
- Python: references/sdk-init-python.md
- Java: references/sdk-init-java.md
- .NET: references/sdk-init-dotnet.md
如果未知语言,请先询问。SDK会自动处理令牌刷新。
Key Concepts
核心概念
@sinch/sdk-core@sinch/voice@sinch/verificationsinchsinch-sdk-javaProject-scoped init — Uses , , . For Conversation, Numbers, Fax, EST, 10DLC, Number Lookup, Provisioning.
projectIdkeyIdkeySecretApplication-scoped init — Uses , . For Voice, Verification, In-App Calling.
applicationKeyapplicationSecretMulti-product client — Provide both project and application credentials in a single to access all APIs.
SinchClientConversation region — Must be set explicitly when using the Conversation API. Values: , , . Required in Python SDK v2.0.0+ and Java SDK v2.0.0+; recommended in Node.js and .NET.
useubr@sinch/sdk-core@sinch/voice@sinch/verificationsinchsinch-sdk-java项目级初始化 —— 使用、、。适用于Conversation、Numbers、Fax、EST、10DLC、Number Lookup、Provisioning产品。
projectIdkeyIdkeySecret应用级初始化 —— 使用、。适用于Voice、Verification、应用内通话产品。
applicationKeyapplicationSecret多产品客户端 —— 在单个中同时提供项目和应用凭证,以访问所有API。
SinchClient对话区域 —— 使用Conversation API时必须显式设置。可选值:、、。Python SDK v2.0.0+和Java SDK v2.0.0+要求必须设置;Node.js和.NET建议设置。
useubrCommon Patterns
常见模式
- Project-scoped quick start — Init with project credentials. See language-specific ref.
SinchClient - Application-scoped quick start — Init with app key/secret. See language-specific ref.
SinchClient - Multi-product client — Pass both credential sets to a single client instance.
- Regional Conversation API — Set during init (required in Python/Java, recommended elsewhere).
conversationRegion
- 项目级快速入门 —— 使用项目凭证初始化。请查看对应语言的参考文档。
SinchClient - 应用级快速入门 —— 使用应用密钥/凭证初始化。请查看对应语言的参考文档。
SinchClient - 多产品客户端 —— 将两组凭证传递给单个客户端实例。
- 区域化Conversation API —— 初始化时设置(Python/Java要求必须设置,其他语言建议设置)。
conversationRegion
Gotchas
注意事项
- Not all products are available in all SDKs — Check the Product Coverage table before recommending an SDK. For unsupported products, use direct HTTP calls.
- Conversation region is required — Python and Java SDKs fail at runtime without . Node.js and .NET don't enforce it yet but should set it explicitly.
conversation_region - Voice/Verification use application credentials — These are a separate credential set from project Access Keys.
- SDKs auto-refresh OAuth2 tokens — No need to manually handle token expiry when using SDKs.
- 并非所有产品都支持所有SDK —— 在推荐SDK前请先查看产品支持表。对于不支持的产品,请使用直接HTTP调用。
- 对话区域为必填项 —— Python和Java SDK如果未设置会在运行时失败。Node.js和.NET目前未强制要求,但建议显式设置。
conversation_region - Voice/Verification使用应用凭证 —— 这些凭证与项目访问密钥是独立的。
- SDK会自动刷新OAuth2令牌 —— 使用SDK时无需手动处理令牌过期。