Deepgram
Send Deepgram live transcription results to a conversation.
Sparkle reads the Results messages of a Deepgram live transcription stream. Deepgram can post them
to the receiver URL itself, or your server can forward them from its WebSocket.
Use this receiver when your code already creates the conversation and wants its id, its own
webhook_url or its title up front. When streams start outside your code, a
Deepgram connection creates a conversation per stream for you.
Quickstart
Create a conversation with a Deepgram receiver
Create a conversation with "receivers": ["deepgram"]:
curl -X POST https://api.sparkle.ai/public/v1/conversations \
-H "X-API-Key: $SPARKLE_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{"title": "Support call", "receivers": ["deepgram"]}'The response's receivers list holds the receiver's path, shown only this once. Prefix it with the
API's origin to get the receiver URL:
https://api.sparkle.ai/public/v1/receivers/deepgram/<token>The URL is the credential
The token in the URL is the receiver's only authentication: Deepgram doesn't sign its requests. Anyone who holds the URL can add turns to the conversation, so keep it on your server like an API key.
Send the results
Turn on diarization (diarize=true) so turns are split by speaker. Then send the results in one of
two ways:
Add the receiver URL as the stream's callback, URL-encoded. Deepgram then posts each streaming
response to it:
wss://api.deepgram.com/v1/listen?model=nova-3&diarize=true&callback=https%3A%2F%2Fapi.sparkle.ai%2Fpublic%2Fv1%2Freceivers%2Fdeepgram%2F<token>Receive moments
Final results become turns, and the conversation's moments arrive as
moment.detected webhooks and on its event stream. Add "webhook_url" to the
create to receive them at a URL of this conversation's own.
How the receiver reads results
- Only
Resultsmessages withis_final: truebecome turns. Interim results and other message types (Metadata,SpeechStarted,UtteranceEnd) are ignored. The receiver answers204either way. - A result is split into one turn per run of words from the same speaker. The turn's text uses
punctuated_wordwhen present. - The speaker is Deepgram's speaker number, prefixed with the channel when it isn't the first
(
1:0). Without diarization, all words in a channel belong to speaker0. - Turn times are Deepgram's word
startandend: seconds since the stream started. - Sending the same result again replaces its turns.
Speaker numbers restart on reconnect
Deepgram numbers speakers per connection. After a reconnect, speaker 0 may be a different
person. If you need the same speaker key across reconnects, send turns with your own keys through
the conversation's turns endpoint instead.
Responses
| Status | Meaning |
|---|---|
204 | Accepted, or ignored. |
401 | The URL's token names no conversation. |
413 | The body is larger than 1 MB. |
429 | More than 1,200 requests in a minute to one receiver URL. |
The receiver checks the token only when a message has a final result to add, so an interim message
with a wrong token still gets 204.