This article shows how you can export a speech-to-text transcription (STT) from CloudTalk to HubSpot using our workflow automations model, for cases where HubSpot's native transcription functionality does not work with your solution.
User Level:
- Admin 
HubSpot Transcription Export
We recommend using HubSpot's native functionality for transcriptions when possible.
Requirements
- existing workflow with a Recording Uploaded trigger for transcription creation 
- HubSpot admin role with access to private apps 
HubSpot has updated its authorization logic for API requests. Now, all requests are authenticated using the OAuth authorization stored within your initial integration instance with HubSpot.
- For newly created workflow automations, this means there is no need to manually format additional keys or authentication headers in your endpoint URL or setup. 
- However, there is a limitation - only workflow automations linked to the most recently configured HubSpot integration instance will function. If multiple HubSpot integration instances exist, only the latest one will be active for automations. 
Setup
- From the dashboard, navigate to Account > Workflow Automations. 
- Select - +Add Workflowand name your workflow.
- For a trigger Object, select - Transcription. Action:- Created.- Optional: Add a condition statement if you only want transcriptions to export to HubSpot when the logical filter is met. To forward all transcriptions to HubSpot, delete this step. 
 
- As an Action, select - API request.
- Select Add header: 
- In the Values section (the request body), include the following key-value pairs with the Format set to - AUTO:- Key: - engagement.active, Value:- True
- for Key - associations.contactIds.0paste the following Value:- {%- for url in event.properties.call.contacts[0].external_urls -%} {%- if url.integration_name == "hubspot" -%} {{ url.external_url | split("/") | last}} {%- endif -%} {%- endfor -%}
 
- for Key - metadata.bodypaste the following Value:- {% set arr = [- { time: 0,- person: '',- text: 'text'- }] %}{% set items = event.properties.transcription.json %}{% for item in items %}{% if item.out | length > 0 %}{% set arr = (arr.push({- time: item.timestamp | int,- person: 'Agent',- text: item.out- }), arr) %}{% endif %}{% if item.in | length >0 %}{% set arr = (arr.push({- time: item.timestamp | int,- person: 'Contact',- text: item.in- }), arr) %}{% endif %}{% endfor %}{% set sorted = arr |sort(attribute='time') %}{% for item in sorted %}{% if item.time < 1 %}<span><strong>Transcription of call between Cloudtalk and {{ event.properties.call.contacts[0].name }} </strong></span><br>{%elif item.time > 0%}{{item.person}} : '{{item.text}}'<br>{% endif %}{% endfor %}
 
- Key: - engagement.type, Value:- NOTE
 
- When done, select - Confirm and continue.
- Use the top toggle to set your workflow as active and select - Saveto enact your changes.- Confirmcreation of the workflow.
Reference for Key-Values in Request Body
- engagement.activeaccesses the activity of the HubSpot (HS) engagement.
- The code pasted for - associations.contactIds.0extracts the desired contact ID from the external URL.
- The code pasted for - metadata.bodycontains dynamic references (in Nunjuks) to the CSV transcription. This builds an output for the body of the note.
- engagement.typereferences the type of engagement to output.
Have more questions? Don't hesitate to contact our Support team. We're always here to help you!





