> ## Documentation Index
> Fetch the complete documentation index at: https://help.cloudtalk.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Export Speech-to-Text to HubSpot

> Export your call transcriptions into HubSpot as notes

> [!NOTE]
>
> This article shows how you can export a [speech-to-text transcription](https://help.cloudtalk.io/en/articles/5671571-speech-to-text-transcription.md) (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

***

> [!WARNING]
>
> **We recommend using [HubSpot's native functionality](https://knowledge.hubspot.com/calling/review-call-recordings-and-transcripts)** for transcriptions when possible.

## Requirements

* existing workflow with a **Recording Uploaded** trigger for [transcription creation](https://help.cloudtalk.io/en/articles/5671571-speech-to-text-transcription.md)

* HubSpot admin role with access to private apps

> [!NOTE]
>
> 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

1. From the dashboard, navigate to **Settings > Workflow Automations**.

2. Select **`+Add Workflow`** and name your workflow.

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

   ![](https://mintcdn.com/cloudtalk/9VIELngG1B1_Y1Cb/images/help-center/articles/8386173/1c857262d156-screenshot-2025-03-18-at-15-17-11.png?fit=max\&auto=format\&n=9VIELngG1B1_Y1Cb\&q=85\&s=426631ca2460cb7b4760af60af82e361)

   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`](https://api.hubapi.com/engagements/v1/engagements)

   2. **Method**: `POST`

      ![](https://mintcdn.com/cloudtalk/9VIELngG1B1_Y1Cb/images/help-center/articles/8386173/0a02fdc7070e-screenshot-2025-03-18-at-15-18-45.png?fit=max\&auto=format\&n=9VIELngG1B1_Y1Cb\&q=85\&s=e5cb0d1edc89e63cbd545f57dd147891)

5. Select **Add header**:

   1. **Key:** `content-type`

   2. **Value:** `application/json`

      ![](https://mintcdn.com/cloudtalk/9VIELngG1B1_Y1Cb/images/help-center/articles/8386173/d63c7132f5f7-screenshot-2025-03-18-at-15-19-59.png?fit=max\&auto=format\&n=9VIELngG1B1_Y1Cb\&q=85\&s=672e29153e28d268a199a10f89385bce)

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`

      ![](https://mintcdn.com/cloudtalk/9VIELngG1B1_Y1Cb/images/help-center/articles/8386173/1224858bf1f5-screenshot-2025-03-18-at-15-32-48.png?fit=max\&auto=format\&n=9VIELngG1B1_Y1Cb\&q=85\&s=a6492c86c81c9ffe7847754f9d784e9d)

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.

   ![](https://mintcdn.com/cloudtalk/9VIELngG1B1_Y1Cb/images/help-center/articles/8386173/04d60bd8a00a-screenshot-2025-03-18-at-15-33-35.png?fit=max\&auto=format\&n=9VIELngG1B1_Y1Cb\&q=85\&s=ee551f1e66cab7c865798ebe93ab0c15)

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

***

*Need help or have a question?* Just reach out through our [Support portal](https://support.cloudtalk.io/hc/en-us/requests/new?ticket_form_id=26305535257884) — we’re here for you.


## Related topics

- [Export Voicemail Speech-to-Text](https://help.cloudtalk.io/en/articles/6926594-export-voicemail-speech-to-text.md)
- [Speech-to-Text Transcription](https://help.cloudtalk.io/en/articles/5671571-speech-to-text-transcription.md)
- [Workflow Automations guide](https://help.cloudtalk.io/en/articles/10568412-workflow-automations-guide.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.