Tips, Tricks & Best Practices

jforte
Top Contributor

Auto-Translate SDR Notes & Conquer the Language Barrier!

HubSpot Users Rejoice! Auto-Translate SDR Notes & Conquer the Language Barrier!

Ever wished your HubSpot could speak Esperanto? Struggling with handoffs because your SDRs are rockstars in a different language? You're not alone! This highly-requested feature might just be your new best friend.

 

Stop the frustration: No more deciphering cryptic messages or pretending to understand "synergistic market penetration."

 

Boost your sales velocity: Seamless communication = faster handoffs and more closed deals.

 

Ready to finally conquer the language barrier and dominate your sales goals? Let's dive in!

 

P.S. Don't forget to share your success stories and kudos in the comments below! We love to hear from happy Hubspotters.

 

What you need to know before going through this guide!

Why did I made this: To enable all managers to check whatever the SDRs/BDRs/AEs are sending to each other without blocking them (if they struggle with english) or risking to lose key info on those notes.

 

What do you need to build it: Operations Hub Professional; Free DeepL account; 5min to read this step-by-step guide and 2 seconds to give kudos at the end.

 

What happens in this workflow: Copies the most recent note before the Handoff, formats the property, by API (Private App) sends to DeepL that returns the translated property and finally creates the new note translated.

 

Step-by-step guide

Step 01 - Get Your Assets Ready

1.1 - Build Your Private App

First we should build a Private App in order to communicate with our account through workflows. On you Hubspot Account go to Settings > Integrations > Private Apps > Click on "Create a private app" and call it "Hubspot Workflows".

 

Screenshot_15.jpg

 

Than you should set the scopes you want, for this case you only need to give access to crm.objects.contacts.write and crm.objects.contacts.read Later if you want to use the same API for other workflows you could increase the scope of it.

 

1.2 - Create a multi-text property

On the contact object you should create the property that will be later used as holder of your notes.

 

Go to settings > Properties > Contact Properties and make it clear that it's a property only used for backend actions (i.e: [SYSTEM] Translated Note).

 

1.3 - Start your DeepL free trial

Later we'll need the API Token of your account in order to translate your property.

 

Those guys ask for credit card before signing up but since their trial plan is focused on usage and not time you don't need to worry about.

 

Now that you signed up just go to Account > API Keys > Create your key and leave the tab open. 

 

Screenshot_1.jpg

 

Tips & Tricks: You can use any other translation solution that has an integration through API solution. This seems to be the best free version

 

1.4 - Create a contact to test this out

 

Step 02 - Translate your property (1/2)

2.1.1 - Let's go with the Basics

Simply go to Automations > Workflow > Build Workflow > Select a contact based one (blank).

 

Do not set your triggers for now.

 

2.1.2 - Send the most recent note to the property system

We need to do this in order to translate what's on the note body.

 

Add a new action > CRM > Set property value

 

Select your property on property to set (in this example we called "[SYSTEM] Translated Note") and a text box will open > Click on "Edit available data" and select Notes: Most Recently Updated. 

 

Screenshot_2.jpg

 

Back to the text box you should change the action output to Notes and get the Note body 'property' - Feel free to add any tag before the text so your team can easily understand that is simply the translation of another note.

 

Screenshot_3.jpg

 

2.1.3 - Clean your property format

Since format tags will came along with the note we should Add a new action > Data ops > Format Data

 

Select your property to format > Ask to remove HTML tags and set the Output type as String.

 

Than you need to add another action > CRM > Copy property value > By clicking on "value to copy from" a new column will open and you should search for "Action outputs" on the first selection box "action outputs from".

 

Target that output back to your property "[SYSTEM] Translated Note".

 

2.1.3 - Build a custom code action to translate your property

We'll now send the property value to DeepL via API.

 

Add a new action > Data ops > Custom Code.

 

You can keep the Language as Node.js 20.x

 

Go get your DeepL API Token > Go back to your workflow > Click on Secrets > Add secret > The name of your secret should be DEEPL_KEY and the value your DeepL API Token

 

On "Property to include in code" select the property we built and then copy the code below to the open box on your workflow (Credit: Amine Ben Cheikh Brahim https://gist.github.com/AmineBENCHEIKHBRAHIM)

 

const PROPERTY_TO_TRANSLATE = 'PROPERTY INTERNAL NAME HERE';

// Import Axios library for easier HTTP request making
const axios = require('axios')

exports.main = async (event, callback) => {
  // Retrieving the property to translate value from the contact enrolled in the current workflow.
  // This property should be specified in the "Property to include in code" section above the code editor.
  const teste_notes = event.inputFields[PROPERTY_TO_TRANSLATE];
  console.log(`Translating text: ${teste_notes}`);

  // API Call to DeepL API to translate the property value to British English.
  // We didn't specify a source language because the service is capable of detecting the original language automatically.
  axios
    .post('https://api-free.deepl.com/v2/translate', null, {
      params: {
        'auth_key': '' + process.env.DEEPL_KEY,
        'text': '' + teste_notes,
        'target_lang': 'EN-GB'
      }
    })
    .then(response => {
      // Retrieve the translated text from the response
      let translatedToEnglishText = response.data.translations[0].text;
      console.log(translatedToEnglishText);

      // Store the text in an output String called "englishText". It can then be
      // copied in a property using "copy property value" workflow action.
      callback({
        outputFields: {
          englishText: translatedToEnglishText
        }
      })
    });
}

 

Now that you've updated your code with the internal name of your property (you should take "PROPERTY INTERNAL NAME HERE" and add your property internal name) you should scroll down and click on Add output set the Data type as String and call it englishText.

 

Create a note in any language rather than english on previously created contact and test it out. It should look like these:

 

Screenshot_4.jpg

 

Than you need to add another action > CRM > Copy property value > By clicking on "value to copy from" a new column will open and you should search for "Action outputs" on the first selection box "action outputs from", under Custom code the "englishText" property should appear.

 

Step 02 - Build a translated note automatically (2/2)

Let's pick this translation and build a note out of it!

 

Add a new action > Data ops > Custom Code.

 

You can keep the Language as Node.js 20.x

 

In this case you don't need to use secrets since I'm adding our API Token directly to the code.

The secret it's an object that hides your API Token so that way you could easily share your code with others since they would not be able to mess with your API.

 

[IMPORTANT] Keep in mind that this way you should NEVER share your code on community's, ChatGPT or any public forum since everyone can mess with your Hubspot Account as soon they get your API Token.

 

On "Property to include in code" select the property we built and then copy the code below to the open box (Edited code base on @mfoldager post)

 

const axios = require('axios');

const apiKey = 'YOUR API KEY HERE';

exports.main = async (event, callback) => {
  const testenotes = event.inputFields['PROPERTY_INTENALNAME_HERE'];
  try {
    const options = {
      method: 'POST',
      url: 'https://api.hubspot.com/engagements/v1/engagements',
      headers: {
        'Content-Type': 'application/json',
        Authorization: `Bearer ${apiKey}`,
      },
      data: {
        engagement: {
          active: true,
          type: 'NOTE',
        },
        associations: {
          contactIds: [event.object.objectId],
          companyIds: [],
          dealIds: [],
          ownerIds: [],
        },
        attachments: [],
        metadata: { body: testenotes
      },
      },
    };

    const response = await axios(options);

    if (response.status !== 200) {
      throw new Error(`Error creating note: ${response.statusText}`);
    }

    console.log("HubSpot note created successfully!");
    callback({
      outputFields: {
        body: response.data,
      },
    });

  } catch (error) {
    console.error("Error creating note:", error);
    // Implement error handling logic here (e.g., retry, notify admins)
  }
};

 

Go get your API Token > Settings > Integrations > Private Apps > Click on the previously create Private App > Take "YOUR API KEY HERE" from the code and paste your API Token.

 

Find "PROPERTY_INTENALNAME_HERE" on the code (Ctrl + F) and change it with the internal name of your property.

 

Now that you've updated your code you should scroll down and click on Add output set the Data type as String and call it body.

 

Let's test it out! Your contact notes tab should look like these:

 

Screenshot_5.jpg

 

Step 03 - Let's set your triggers

Now that we're sure everything makes sense we should set the triggers in order to make it automatic.

 

Keep in mind that the DeepL free version has a limit of 500.000 characters per month so play with that.

 

In this example I only enrolled contacts from non-english speaking markets that were recently handoff from the Sales Dev Team to the Sales Team since those notes are key to do process. Do the way that best suit you!

 

Don't forget to share your success stories, your doubts and to leave kudos if this helped you in any way!

José Forte - Hubspot ChampJosé Pedro Forte
RevOps Manager at Infraspeak

• Hubspot Champion User - 2019
• Marketing Hub Champion User - 2020
• +100 Hubspot Community Kudos - 2023
• Community Champion - 2023

Hubspot headaches? Let's turn Oh's into workflows!

Let's Connect !
2 Replies 2
PamCotton
Community Manager
Community Manager

Auto-Translate SDR Notes & Conquer the Language Barrier!

Hey @jforte, Happy Tuesday.

 

 Thank you for sharing your expertise and contributing to smoother workflows for sales teams using HubSpot. Your efforts undoubtedly empower global teams to collaborate seamlessly toward achieving their sales goals.

 

Kindly,

Pam

Você sabia que a Comunidade está disponível em outros idiomas?
Participe de conversas regionais, alterando suas configurações de idioma !


Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !




0 Upvotes
jforte
Top Contributor

Auto-Translate SDR Notes & Conquer the Language Barrier!

I asked for Kudos and you showed how to do it @PamCotton ahaha thanks for the kind words ❤️

José Forte - Hubspot ChampJosé Pedro Forte
RevOps Manager at Infraspeak

• Hubspot Champion User - 2019
• Marketing Hub Champion User - 2020
• +100 Hubspot Community Kudos - 2023
• Community Champion - 2023

Hubspot headaches? Let's turn Oh's into workflows!

Let's Connect !