Texa DeskDevelopers

Server

Swift

Swift Package Manager, github.com/texadigital/texa-swift. The Texa API for server-side Swift, and voice in iOS apps.

Add https://github.com/texadigital/texa-swift with Swift Package Manager, from 1.0.0:

Swift
.package(url: "https://github.com/texadigital/texa-swift", from: "1.0.0")

On a server

TexaClient holds a key: use it on a server (server-side Swift, such as Vapor), never in an app.

Swift
import Texa

let texa = try TexaClient()                     // the key from TEXA_API_KEY
let convo = try await texa.openConversation(["channel": "web", "customer_ref": "user-1842"])

TexaWebhooks.parse(...) checks a webhook's signature.

In an iOS app: voice

Use TexaVoiceLine with the single-use token your server got from voiceSession, so the app never holds a key. It handles ready, audio, captions, flush and ended; you call open, send (microphone audio), say (a typed turn in text mode) and hangup. Capture and playback stay with your app (AVAudioEngine, with echo cancellation on).