TranscriptId while inside agent
Hi @Tico | Voiceflow Assistant how would you grab the transcriptId of the current conversation while in session
4 Replies
Voiceflow doesn’t expose a {transcriptId} variable while the dialog is running.
• During a live session only the sessionID / userID is known inside the agent.
• A transcript record (and its
• The API response returns the new record, e.g. Capture that
1. Call the PUT /v2/transcripts endpoint from a Code step (or from your front-end) as soon as the session starts – you just need:
2. The 200 response comes back with an object that contains: 3. Store the returned
Because a transcript doesn’t exist until you make that call, there isn’t a built-in variable you can reference “live” – you have to trigger the save yourself (web-chat does this automatically for you under the hood).
Docs: https://developer.voiceflow.com/v2.0/reference/put_transcripts
• A transcript record (and its
_id
, the transcriptId) is created only when you call the Transcripts API (PUT https://api.voiceflow.com/v2/transcripts
) or when the web-chat widget makes that same call for you.• The API response returns the new record, e.g. Capture that
_id
in your front-end code or in a Voiceflow Function block that makes the call, then store it in a variable if you still need it later in the flow.
So, inside the agent you would:
1. Make the PUT /transcripts
request when you’re ready to save the conversation (pass your projectID, versionID and the current sessionID/userID).
2. Read response.json._id
– that’s the transcriptId.
3. Put that value into a Voiceflow variable (via the Function block’s outputVars
) if you need to reference it elsewhere in the dialog.
If you’re using the out-of-the-box Web Chat, listen for the widget’s transcript-save callback (it runs the same API call) and grab the returned _id
there.
Docs: https://developer.voiceflow.com/v2.0/reference/put_transcripts
Voiceflow only assigns a transcriptId
once you create / save a transcript through the Transcripts API.1. Call the PUT /v2/transcripts endpoint from a Code step (or from your front-end) as soon as the session starts – you just need:
2. The 200 response comes back with an object that contains: 3. Store the returned
_id
in a VF variable if you need to tag the transcript, add notes, etc. later in the same conversation.Because a transcript doesn’t exist until you make that call, there isn’t a built-in variable you can reference “live” – you have to trigger the save yourself (web-chat does this automatically for you under the hood).
Docs: https://developer.voiceflow.com/v2.0/reference/put_transcripts
@Conner I can help with this if you haven't figured it out already.
@Steve B. | IntelleSync.ai I got it Steve, but thanks buddy 🙂
@Conner Great stuff! 😀