Skip to main content

Hubspot-Article-Translator

Auto translation of Hubspot Knowledgebase Articles powered by Selenium

Important Disclaimer

This application only performs upserts to DRAFT articles. It will never modify an article that is published.

Demo Videos

https://github.com/noodle-factory/Hubspot-Article-Translator/assets/53892067/da218794-033d-45fd-9d80-330ca62ba9d5

Installation

  1. Install Google Chrome; This module depends on a chrome driver, so selenium can leverage off of it.

  2. pip install hubspot-Article-Translator

How to use module

Configuring Translation APIs

AWS API

import boto3

from hubspot_article_translator import translation_manager, AWSTranslateClient





if __name__ == "__main__":

    # Setup Translation Client/s

    boto3.setup_default_session()

    translation_manager.add_clients(

        AWSTranslateClient(

            aws_session=boto3.DEFAULT_SESSION

        )

    )

Azure API

from hubspot_article_translator import translation_manager, AzureTranslateClient





if __name__ == "__main__":

    # Setup Translation Client/s

    translation_manager.add_clients(

        AzureTranslateClient(

            key="<AZURE_TRANSLATE_KEY>",

            location="<AZURE_TRANSLATE_LOCATION>",

            endpoint="<AZURE_TRANSLATE_ENDPOINT>",

            api_version="<AZURE_TRANSLATE_API_VERSION>"

        )

    )

Executing the translation workflow

import boto3

from selenium import webdriver

from hubspot_article_translator import State, workflow, translation_manager, AWSTranslateClient, AzureTranslateClient





if __name__ == "__main__":

    # Create the selenium Chrome driver

    driver = webdriver.Chrome()



    # Execute the workflow, passing parameters into State object

    workflow.execute(

        driver=driver,

        state=State(

            # Your Hubspot Account Email

            email="<HUBSPOT EMAIL>",



            # Your Hubspot Account Password

            password="<HUBSPOT PASSWORD>",



            # 2FA code from Authenticator App

            code="<HUBSPOT 2FA CODE>",



            # List of article IDs to translate

            article_ids=["<ID OF ARTICLE TO TRANSLATE>", ...],



            # The ID of the knowledge base that the above articles are in

            knowledge_base_id="<ID OF THE KNOWLEDGE BASE>",



            # the source language of articles

            from_language="en",



            # the languages each article will be translated to

            # make sure key aligns with content language codes

            # https://github.com/noodle-factory/Hubspot-Article-Translator/blob/master/hubspot_article_translator/translation/content_languages/content_languages.json

            # make sure value is exactly the name of the language in Hubspot

            to_languages={

                "es": "Spanish",

                "pt-pt": "Portuguese - Portugal",

                "id": "Indonesian"

            },



            # Automatically publish the article once translation is done

            # Note ensure that you have setup all the knowledge base category translations for each language...

            # Otherwise you won't be able to publish the articles

            auto_publish=True|False 

        )

    )



    # Close the selenium Driver

    driver.quit()

Tips & tricks

Getting all the article IDs

It would be time consuming to get all the article IDs from each page manually. Instead, navigate to the knowledge base articles page, then open the console and paste this command

[...document.querySelectorAll('[data-test-object-id]')].map(e => e.getAttribute('data-test-object-id')).join("|")

Known Limitations

  1. This hasn't been tested with other browsers, it will likely only work with Chrome currently

  2. The account must be configured with 2FA through the authenticator app, and not a mobile phone number

Metadata

Release files for hubspot-article-translator 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hubspot-article-translator 0.1.1
File Size Uploaded Provenance Actions
hubspot_article_translator-0.1.1.tar.gz 10.7 kB Without provenance Details for hubspot_article_translator-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hubspot-article-translator 0.1.1
File Interpreter ABI Platform Actions
hubspot_article_translator-0.1.1-py3-none-any.whl Python 3 none any Details for hubspot_article_translator-0.1.1-py3-none-any.whl

Total release size: 22.2 kB

Release files / hubspot_article_translator-0.1.1.tar.gz

Download URL hubspot_article_translator-0.1.1.tar.gz
Size 10.7 kB
Tags Source
SHA-256 checksum
How to use checksums
79bce8377e2eb9c1dbec6f7dc151a91bc749b908ed9fede0e49356dec0abd124
BLAKE2b-256 checksum
How to use checksums
c1e66d30791bcab0527d0e730789d6ebb25647dbd3b4841690229ad45d470b27
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / hubspot_article_translator-0.1.1-py3-none-any.whl

Download URL hubspot_article_translator-0.1.1-py3-none-any.whl
Size 11.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
72ec1328448305633e080caa6d7d853e7ac8d2940a1698f0fb6c093fb350ec0c
BLAKE2b-256 checksum
How to use checksums
89933716f604229dacfc26695534335497156a0c7547cdc08ffcb13fcc672e36
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Security for hubspot-article-translator 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page