Official Sinch API skills for AI coding agents — SMS, Voice, Verification, Numbers, Mailgun email, and more.
71
89%
Does it follow best practices?
Impact
—
No eval scenarios have been run
Advisory
Suggest reviewing before use
In-App Calling uses the Sinch RTC SDK (Swift) — a separate client-side SDK from @sinch/sdk-core. Authentication is handled via JWT tokens generated on your backend using Application Key + Application Secret credentials.
Based on the official getting-started guide.
Download the Sinch Swift SDK from the SDK download page and add SinchRTC.xcframework to your Xcode project. Set it to Embed & Sign — otherwise you'll get dylib loading failures.
In your project's Target → Signing & Capabilities:
Create a Config.swift file:
let APPLICATION_KEY = "YOUR_APPLICATION_KEY"
// Never commit APPLICATION_SECRET in client code — serious security risk.
// In production, JWT generation must be delegated to your backend.
let APPLICATION_SECRET = "YOUR_APPLICATION_SECRET"
let ENVIRONMENT_HOST = "ocra.api.sinch.com"Create a SinchClientMediator class as a wrapper around SinchClient:
import SinchRTC
import OSLog
typealias ClientStartedCallback = (_ error: Error?) -> Void
class SinchClientMediator {
var clientStartedCallback: ClientStartedCallback!
private(set) var sinchClient: SinchClient?
func createAndStartClient(with userId: String, and callback: @escaping (_ error: Error?) -> Void) {
do {
sinchClient = try SinchRTC.client(withApplicationKey: APPLICATION_KEY,
environmentHost: ENVIRONMENT_HOST,
userId: userId)
} catch let error as NSError {
callback(error)
return
}
clientStartedCallback = callback
guard let sinchClient = sinchClient else { return }
sinchClient.delegate = self
sinchClient.start()
}
}Implement SinchClientDelegate for credential provisioning and client status monitoring:
extension SinchClientMediator: SinchClientDelegate {
func clientRequiresRegistrationCredentials(_ client: SinchRTC.SinchClient,
withCallback callback: SinchRTC.SinchClientRegistration) {
do {
// WARNING: test implementation — in production, generate JWT on your backend
let jwt = try SinchJWT.sinchJWTForUserRegistration(withApplicationKey: APPLICATION_KEY,
applicationSecret: APPLICATION_SECRET,
userId: client.userId)
callback.register(withJWT: jwt)
} catch {
callback.registerDidFail(error: error)
}
}
func clientDidStart(_ client: SinchClient) {
guard clientStartedCallback != nil else { return }
clientStartedCallback(nil)
clientStartedCallback = nil
}
func clientDidFail(_ client: SinchClient, error: Error) {
guard clientStartedCallback != nil else { return }
clientStartedCallback(error)
clientStartedCallback = nil
}
}Note: The
SinchJWThelper for test JWT generation is available in the Swift reference application and bundled with the SDK. In production, always generate JWTs on your backend.
Upload your APNs signing key to your Sinch application configuration. See configuring APNs for details. Expired certificates cause silent failures.
import OSLog
import SinchRTC
SinchRTC.setLogCallback { (severity: SinchRTC.LogSeverity,
area: String,
msg: String,
_: Date) in
os_log("%{public}@", log: .sinchOSLog(for: area), type: severity.osLogType, msg)
}environmentHost is the REST API endpoint the SDK targets (ocra.api.sinch.com for production)userId is the user identifier registered within your applicationSinchClient is a singleton per user session — create one instance and retain it for the entire app lifetimeclientRequiresRegistrationCredentials callback fires on start and when the registration TTL nears expiryskills
sinch-10dlc
references
sinch-authentication
sinch-conversation-api
sinch-elastic-sip-trunking
references
sinch-fax-api
sinch-imported-numbers-hosting-orders
references
sinch-in-app-calling
sinch-mailgun
references
sinch-mailgun-inspect
references
sinch-mailgun-optimize
references
sinch-mailgun-validate
sinch-number-lookup-api
sinch-number-order-api
sinch-numbers-api
references
sinch-porting-api
sinch-provisioning-api
sinch-sdks
sinch-verification-api