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 authorization logic has changed as of March 2023. Requests made to HubSpot's API are now authenticated using the OAuth authorization saved within your first integration instance with HubSpot.
For newly created workflow automations, this means you don't need to format any additional keys or authentication headers into your endpoint url or setup.
The limitation is that you can no longer have multiple HubSpot integration instances with workflow automations—only automations from the most recently configured integration instance will run.
Setup
From the dashboard, navigate to Account > Workflow Automations.
Select
+Add Workflow
and 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.0
paste 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.body
paste 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
Save
to enact your changes.Confirm
creation of the workflow.
Reference for Key-Values in Request Body
engagement.active
accesses the activity of the HubSpot (HS) engagement.
The code pasted for
associations.contactIds.0
extracts the desired contact ID from the external URL.The code pasted for
metadata.body
contains dynamic references (in Nunjuks) to the CSV transcription. This builds an output for the body of the note.engagement.type
references the type of engagement to output.
Have more questions? Don't hesitate to contact our Support team. We're always here to help you!