Skip to main content
All CollectionsIntegrationsIntegrated Workflows
Export Speech-to-Text to HubSpot
Export Speech-to-Text to HubSpot

Export your call transcriptions into HubSpot as notes

S
Written by Shelby Glynn
Updated over 5 months ago

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

  1. From the dashboard, navigate to Account > Workflow Automations.

  2. Select +Add Workflow and name your workflow.

  3. For a trigger Object, select Transcription. Action: Created.

    1. 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.

  4. As an Action, select API request.

    1. Endpoint: https://api.hubapi.com/engagements/v1/engagements

    2. Method: POST

  5. Select Add header:

    1. Key: content-type

    2. Value: application/json

  6. In the Values section (the request body), include the following key-value pairs with the Format set to AUTO:

    1. Key: engagement.active, Value: True

    2. for Key associations.contactIds.0 paste the following Value:

      1. {%- for url in event.properties.call.contacts[0].external_urls -%} {%- if url.integration_name == "hubspot" -%} {{ url.external_url | split("/") | last}} {%- endif -%} {%- endfor -%}

    3. for Key metadata.body paste the following Value:

      1. {% 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 %}

    4. Key: engagement.type, Value: NOTE

  7. When done, select Confirm and continue.

  8. 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!

Did this answer your question?