How can we connect sparkTG to LiveKit agents?
# ask-ai
b
How can we connect sparkTG to LiveKit agents?
t
Thanks for reaching out, Ashish. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I can help with that. A few quick questions so I give the right steps: 1. By "sparkTG" do you mean the Telegram-based bot/service named SparkTG, or something else? 2. Which LiveKit component do you want to connect to: a LiveKit Room (agents join as participants), the LiveKit server SDK, or an external agent service that should control rooms/sessions? 3. Where will the integration run (server-side backend, serverless function, or client app)? Which language/runtime? 4. Do you already have LiveKit API keys/URL and a sparkTG webhook or bot token set up? 5. What behavior do you expect from the agents once connected (voice only, video, data messages, signaling to join/leave, recording, real-time commands)? With those answers I’ll outline the exact integration flow and provide code snippets for the best fit (token generation + authentication, joining rooms, and sending/receiving messages). Would you like examples for Node.js or Python?
b
SparkTG is a cloud telephony provider - https://sparktg.com/apis/transfer-call
t
Thanks — I’ll help map how SparkTG can connect to LiveKit agents. Quick summary of the path we can take: LiveKit supports SIP trunks and SIP call transfer (including sending SIP REFER). If SparkTG can present a SIP trunk and supports SIP REFER, you can connect it to LiveKit using LiveKit’s SIP trunk APIs and transfer calls between telephony and LiveKit participants. Please confirm the following so I can give step-by-step instructions and code samples (Node.js or Python): 1. Does SparkTG provide SIP trunking (SIP URI, credentials) and support SIP REFER for call transfer? 2. Do you want inbound PSTN calls routed into LiveKit rooms, outbound calls from LiveKit to PSTN, or both? 3. Where will you run the integration (your server/backend) and which language/runtime do you prefer for examples? 4. Do you already have LiveKit credentials and an instance URL, and do you have permission to create SIP trunks (requires `sip.admin`/`sip.call` grants)? If you confirm 1–4 I’ll provide: • Exact LiveKit APIs to call (
CreateSIPInboundTrunk
,
CreateSIPOutboundTrunk
,
CreateSIPDispatchRule
,
TransferSIPParticipant
) with a concise flow for inbound/outbound and transfer scenarios. • Token/auth guidance and a short Node.js or Python snippet to create the trunk and initiate a transfer. Which runtime would you like examples for? Sources: SIP overview | LiveKit docs | SIP APIs | LiveKit docs | Call forwarding | LiveKit docs