{"id":38961396,"url":"https://github.com/intento/intento-nodejs","last_synced_at":"2026-01-17T16:25:06.666Z","repository":{"id":31400340,"uuid":"127443174","full_name":"intento/intento-nodejs","owner":"intento","description":"A JS adapter to query Intento API – a single API to Cognitive AI services from many vendors","archived":false,"fork":false,"pushed_at":"2025-09-13T05:34:29.000Z","size":1087,"stargazers_count":8,"open_issues_count":10,"forks_count":2,"subscribers_count":23,"default_branch":"master","last_synced_at":"2025-10-23T01:53:00.676Z","etag":null,"topics":["ai","cognitive-services","cognitive-toolkit","dictionary-tools","sdk-js","sentiment-analysis","translation"],"latest_commit_sha":null,"homepage":"https://inten.to","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/intento.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2018-03-30T15:26:24.000Z","updated_at":"2023-06-09T10:02:17.000Z","dependencies_parsed_at":"2024-11-27T02:23:28.349Z","dependency_job_id":"647b2112-f036-45e1-acda-1ad69065d7c7","html_url":"https://github.com/intento/intento-nodejs","commit_stats":null,"previous_names":[],"tags_count":33,"template":false,"template_full_name":null,"purl":"pkg:github/intento/intento-nodejs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intento%2Fintento-nodejs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intento%2Fintento-nodejs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intento%2Fintento-nodejs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intento%2Fintento-nodejs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/intento","download_url":"https://codeload.github.com/intento/intento-nodejs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/intento%2Fintento-nodejs/sbom","scorecard":{"id":491156,"data":{"date":"2025-08-11","repo":{"name":"github.com/intento/intento-nodejs","commit":"00fb3b6decc8ab11b13aceb9b24d11628a9ee21b"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.9,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":1,"reason":"Found 4/21 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 14 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"25 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-wf5p-g6vw-rhxx","Warn: Project is vulnerable to: GHSA-8hc4-vh64-cxmj","Warn: Project is vulnerable to: GHSA-jr5f-v2jv-69x6","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-x9w5-v3q2-3rhw","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-434g-2637-qmqr","Warn: Project is vulnerable to: GHSA-49q7-c7j4-3p7m","Warn: Project is vulnerable to: GHSA-977x-g7h5-7qgw","Warn: Project is vulnerable to: GHSA-f7q4-pwc6-w24p","Warn: Project is vulnerable to: GHSA-fc9h-whq2-v747","Warn: Project is vulnerable to: GHSA-vjh7-7g9h-fjfh","Warn: Project is vulnerable to: GHSA-jchw-25xp-jwwc","Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-h7cp-r72f-jxh6","Warn: Project is vulnerable to: GHSA-v62p-rq8g-8h59","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-76p7-773f-r4q5","Warn: Project is vulnerable to: GHSA-4vvj-4cpr-p986","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-19T19:11:29.911Z","repository_id":31400340,"created_at":"2025-08-19T19:11:29.911Z","updated_at":"2025-08-19T19:11:29.911Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28511860,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T13:38:16.342Z","status":"ssl_error","status_checked_at":"2026-01-17T13:37:44.060Z","response_time":85,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","cognitive-services","cognitive-toolkit","dictionary-tools","sdk-js","sentiment-analysis","translation"],"created_at":"2026-01-17T16:25:06.598Z","updated_at":"2026-01-17T16:25:06.658Z","avatar_url":"https://github.com/intento.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Intento SDK for Node.js\n\nAn adapter to query Intento API.\n\nIntento provides a single API to Cognitive AI services from many vendors.\n\nTo get more information check out [the site](https://inten.to/).\n\n[API User Manual](https://github.com/intento/intento-api)\n\nIn case you don't have a key to use Intento API, please register here [inten.to](https://inten.to)\n\n\u003c!-- TOC depthFrom:2 --\u003e\n\n- [Installation](#installation)\n- [Command line interface](#command-line-interface)\n- [Try it in a browser](#try-it-in-a-browser)\n- [Basic usage](#basic-usage)\n    - [Translation](#translation)\n    - [Sentiment analysis](#sentiment-analysis)\n    - [Text meanings](#text-meanings)\n- [Explore providers (basics)](#explore-providers-basics)\n    - [Response structure for provider-related requests](#response-structure-for-provider-related-requests)\n    - [List all available providers](#list-all-available-providers)\n        - [Translation providers](#translation-providers)\n        - [Sentiment analysis providers](#sentiment-analysis-providers)\n        - [Text meanings providers](#text-meanings-providers)\n- [Translation capabilities](#translation-capabilities)\n- [Sentiment analysis capabilities](#sentiment-analysis-capabilities)\n- [Text meanings capabilities (dictionary)](#text-meanings-capabilities-dictionary)\n- [Smart routing](#smart-routing)\n    - [Basic smart routing](#basic-smart-routing)\n    - [Specifying a custom routing strategy](#specifying-a-custom-routing-strategy)\n- [Failover mode](#failover-mode)\n- [Using a service provider with your own keys](#using-a-service-provider-with-your-own-keys)\n- [Advanced Examples](#advanced-examples)\n    - [Dynamic parameters](#dynamic-parameters)\n    - [Using `data` argument from a curl request directly](#using-data-argument-from-a-curl-request-directly)\n    - [More examples](#more-examples)\n- [How to pass your API keys to your environment](#how-to-pass-your-api-keys-to-your-environment)\n    - [zero option (dev only)](#zero-option-dev-only)\n    - [1st option](#1st-option)\n    - [2nd option](#2nd-option)\n    - [3rd option](#3rd-option)\n\n\u003c!-- /TOC --\u003e\n\n## Installation\n\n```bash\nnpm install intento-nodejs\n```\n\nor\n\n```bash\nyarn add intento-nodejs\n```\n\n## Command line interface\n\nSee [CLI example](https://github.com/intento/intento-nodejs/tree/master/samples/cli) as one of the ways to use this SDK.\n\n## Try it in a browser\n\nRequires `serve` to be installed globally in your system\n\n```sh\nyarn global add serve\nyarn build # it will prepare minified files, see ./dist folder\nyarn test-in-browser\n# Visit http://localhost:5000/samples/browser-app\n```\n\nGo to an example browser app at [http://localhost:5000/samples/browser-app](http://localhost:5000/samples/browser-app)\n\n## Basic usage\n\nInitialise the client\n\n```js\nconst IntentoConnector = require('intento-nodejs')\nconst client = new IntentoConnector({ apikey: YOUR_INTENTO_KEY })\n```\n\n### Translation\n\nThis is an intent to translate text from one language to another.\n\nRelated [documentation](https://github.com/intento/intento-api/blob/master/ai.text.translate.md)\n\nMore examples in [the sample app](https://github.com/intento/intento-nodejs/blob/master/samples/server-side-app/ai.text.translate.js)\n\nSimple translate text `text` to language `to`:\n\n- source language will be detected automatically\n- provider for the translation will be smart-selected based on the [Smart routing feature](https://github.com/intento/intento-api#smart-routing)\n\n```js\nclient.ai.text.translate\n    .fulfill({ text: \"How's it going?\", to: 'es' })\n    .then(data =\u003e {\n        console.log('Translation results:\\n', data, '\\n\\n')\n    })\n```\n\n### Sentiment analysis\n\nThis is an intent to analyze the sentiment of the provided text.\n\nRelated [documentation](https://github.com/intento/intento-api/blob/master/ai.text.sentiment.md)\n\nMore examples in [the sample app](https://github.com/intento/intento-nodejs/blob/master/samples/server-side-app/ai.text.sentiment.js)\n\n```js\nclient.ai.text.sentiment\n    .fulfill({\n        text: 'We love this place',\n        lang: 'en',\n        provider: 'ai.text.sentiment.ibm.natural_language_understanding',\n    })\n    .then(data =\u003e {\n        console.log('Sentiment analysis results:\\n', data, '\\n\\n')\n    })\n```\n\n### Text meanings\n\nThis is an intent to get meanings of text in selected language.\n\nRelated [documentation](https://github.com/intento/intento-api/blob/master/ai.text.dictionary.md)\n\nMore examples in [the sample app](https://github.com/intento/intento-nodejs/blob/master/samples/server-side-app/ai.text.dictionary.js)\n\n```js\nclient.ai.text.dictionary\n    .fulfill({\n        text: 'meaning',\n        from: 'en',\n        to: 'ru',\n    })\n    .then(data =\u003e {\n        console.log('Dictionary results:\\n', JSON.stringify(data, null, 4), '\\n')\n    })\n```\n\n## Explore providers (basics)\n\n### Response structure for provider-related requests\n\nIn all cases a response object is a list of objects. Each object in that list describes one provider. The structure of the description is following:\n\n```js\n{\n    id: 'provider.id',\n    name: 'Provider Name',\n    score: 0,\n    price: 0,\n    symmetric: [...],\n    pairs: [...],\n}\n```\n\n`symmetric` - is a list of language codes for which translation in both directions is available.\n\n`pairs` - is a list of plain objects with structure `{ from: 'lang-code-1', to: 'lang-code-2' }`. It means that for current provider translation from `lang-code-1` to `lang-code-2` is available.\n\n### List all available providers\n\n#### Translation providers\n\n```js\nclient.ai.text.translate\n    .providers()\n    .then(data =\u003e data.forEach(p =\u003e console.info(p.name)))\n```\n\n#### Sentiment analysis providers\n\n```js\nclient.ai.text.sentiment\n    .providers()\n    .then(data =\u003e data.forEach(p =\u003e console.info(p.name)))\n```\n\n#### Text meanings providers\n\n```js\nclient.ai.text.dictionary\n    .providers()\n    .then(data =\u003e data.forEach(p =\u003e console.info(p.name)))\n```\n\n## Translation capabilities\n\nMore information in [ai.text.translate.md](https://github.com/intento/intento-nodejs/blob/master/ai.text.translate.md)\n\n## Sentiment analysis capabilities\n\nMore information in [ai.text.sentiment.md](https://github.com/intento/intento-nodejs/blob/master/ai.text.sentiment.md)\n\n## Text meanings capabilities (dictionary)\n\nMore information in [ai.text.dictionary.md](https://github.com/intento/intento-nodejs/blob/master/ai.text.dictionary.md)\n\n## Smart routing\n\nIntento provides the smart routing feature, so that the translation request is automatically routed to the best provider. The best provider is determined based on the following information:\n\n- apriori benchmark on the standard dataset\n- provider usage statistics, collected by Intento, including user feedback signals (the post-editing complexity for Machine Translation).\n\n### Basic smart routing\n\nTo use the smart routing, just omit the `provider` parameter:\n\n```js\nclient.ai.text.translate\n    .fulfill({\n        text: \"How's it going?\",\n        to: 'es'\n    })\n    .then(console.log)\n```\n\nResponse:\n\n```json\n{\n    \"id\": \"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\",\n    \"done\": true,\n    \"response\": [\n        {\n            \"results\": [\n                \"¿Qué tal va todo?\"\n            ],\n            \"meta\": {\n                \"detected_source_language\": [\n                    \"en\"\n                ]\n            },\n            \"service\": {\n                \"provider\": {\n                    \"id\": \"ai.text.translate.deepl.api\",\n                    \"name\": \"DeepL API\",\n                    \"vendor\": \"DeepL\",\n                    \"description\": \"API\",\n                    \"logo\": \"https://inten.to/static/img/api/deepl_translate.png\"\n                }\n            }\n        }\n    ],\n    \"meta\": {\n        // information about initial request\n    },\n    \"error\": null\n}\n```\n\n### Specifying a custom routing strategy\n\nBy default, when the provider is missing, requests are routed to a provider with the best expected price/performance ratio. This behavior may be controlled by specifying the desired routing strategy in the `routing` parameter. To set up routing for your account contact us at hello@inten.to.\n\n```js\nclient.ai.text.translate\n    .fulfill({\n        text: 'A sample text',\n        to: 'es',\n        routing: 'best-quality',\n    })\n    .then(console.log)\n```\n\n## Failover mode\n\nBoth for smart routing mode and basic mode, a failover is supported. By default, the failover is off, thus when the selected provider fails, an error is returned. To enable the failover mode, set the `failover` to `true`. By default, failover is governed by the default routing strategy (`best`). To control this behavior, another routing strategy may be specified via `routing` parameter. Alternatively, you may specify a list of providers to consider for the failover (`failover_list`). This option overrides the routing strategy for the failover procedure.\n\nIn the following example we set the provider, but specify the list of alternatives to control the failover:\n\n```js\nclient.ai.text.translate\n    .fulfill({\n        text: 'A sample text',\n        to: 'es',\n        provider: 'ai.text.translate.microsoft.translator_text_api.2-0',\n        failover: true,\n        failover_list: [\n            'ai.text.translate.google.translate_api.2-0',\n            'ai.text.translate.yandex.translate_api.1-5'\n        ]\n    })\n    .then(console.log)\n```\n\n## Using a service provider with your own keys\n\nIntento supports two modes of using 3rd party services:\n\n- full proxy: 3rd party service used via Intento and paid to the Intento (available for some of the services).\n- tech proxy: 3rd party service used via our user's own credentials and billed towards the user's account at the third-party service (available for all services).\n\nIn the tech proxy mode, the custom credentials are passed in the `auth` service field. `auth` field is a dictionary, it's keys are provider IDs. For each ID specify your own key(s) you want to use and values set to a list of keys for the specified provider. There could be more than one key for the provider in the case you want to work with a pool of keys (more on this advanced feature later).\n\n```js\nclient.ai.text.translate\n    .fulfill({\n        text: \"A sample text\",\n        to: 'es',\n        provider: 'some-provider-id',\n        auth: {\n            'some-provider-id': [\n                { ... custom auth structure with 'YOUR_KEY_TO_SOME_PROVIDER_1' ... },\n                { ... custom auth structure with 'YOUR_KEY_TO_SOME_PROVIDER_2' ... },\n            ],\n            'another-provider-id': [\n                { ... another custom auth structure with 'YOUR_KEY_TO_ANOTHER_PROVIDER_1' ... },\n                { ... another custom auth structure with 'YOUR_KEY_TO_ANOTHER_PROVIDER_2' ... },\n            ]\n\n    })\n    .then(console.log)\n```\n\nAuth object structure is different for different providers and may be obtained together with other provider details by requesting info for this provider:\n\n```js\nclient.ai.text.translate\n    .provider('ai.text.translate.google.translate_api.2-0')\n    .then(console.log)\n```\n\nFor example for google translate custom auth structure is `{ key: YOUR_GOOGLE_KEY }`.\n\n```js\nclient.ai.text.translate\n    .fulfill({\n        text: \"A sample text\",\n        to: 'es',\n        provider: 'ai.text.translate.google.translate_api.2-0',\n        auth: {\n            'ai.text.translate.google.translate_api.2-0': [\n                {\n                    key: process.env.YOUR_GOOGLE_KEY\n                }\n            ]\n        }\n    })\n    .then(console.log)\n```\n\nResponse:\n\n```json\n{\n    \"id\": \"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\",\n    \"done\": true,\n    \"response\": [\n        {\n            \"results\": [\n                \"Un texto de muestra\"\n            ],\n            \"meta\": {\n                \"detected_source_language\": [\n                    \"en\"\n                ]\n            },\n            \"service\": {\n                \"provider\": {\n                    \"id\": \"ai.text.translate.google.translate_api.2-0\",\n                    \"name\": \"Google Cloud Basic Translation API\",\n                    \"vendor\": \"Google Cloud\",\n                    \"description\": \"Basic Translation API\",\n                    \"logo\": \"https://inten.to/static/img/api/ggl_translate.png\"\n                }\n            }\n        }\n    ],\n    \"meta\": {\n        // information about initial request\n    },\n    \"error\": null\n}\n```\n\n## Advanced Examples\n\n### Dynamic parameters\n\nDescribe `data` dynamicly through `content`\n\nFor example we'd like to translate the same text for different languages.\nOne can make similar requests for each language like this:\n\n```js\nconst IntentoConnector = require('intento-nodejs')\nconst client = new IntentoConnector({ apikey: process.env.INTENTO_API_KEY })\n\nconst options = {\n    path: '/ai/text/translate',\n    method: 'POST',\n    // content: ...\n}\n\n['es', 'ru', 'da'].forEach(lang =\u003e {\n    client\n        .makeRequest({\n            ...options, // path, method\n            content: {\n                context: {\n                    text: 'A sample text',\n                    to: lang,\n                },\n            },\n        })\n        .then(console.info)\n})\n```\n\nSo you can pass a plain javascript object as a `content` parameter.\n\n### Using `data` argument from a curl request directly\n\nOne can pass request parameters as raw json specified as a `data` parameter.\nMake sure your json is valid. For example one can [validate json online](https://jsonformatter.curiousconcept.com/)\n\nFor a `curl` instruction from [the docs](https://github.com/intento/intento-api)\n\n```bash\ncurl -XPOST -H 'apikey: YOUR_API_KEY' 'https://api.inten.to/ai/text/translate' -d '{\n    \"context\": {\n        \"text\": \"Validation is the king\",\n        \"to\": \"es\"\n    },\n    \"service\": {\n        \"provider\": \"ai.text.translate.microsoft.translator_text_api.2-0\"\n    }\n}'\n```\n\nrun following:\n\n```js\nconst IntentoConnector = require('intento-nodejs')\nconst client = new IntentoConnector({ apikey: process.env.INTENTO_API_KEY })\n\nclient\n    .makeRequest({\n        path: '/ai/text/translate',\n        method: 'POST',\n        data: `{\n            \"context\": {\n                \"text\": \"Validation is the king\",\n                \"to\": \"es\"\n            },\n            \"service\": {\n                \"provider\": \"ai.text.translate.microsoft.translator_text_api.2-0\"\n            }\n        }`,\n    })\n    .then(console.info)\n```\n\n### More examples\n\nTo get more examples:\n\n```bash\ngit clone git@github.com:intento/intento-nodejs.git\ncd intento-nodejs\nINTENTO_API_KEY=YOUR_SECRET_KEY node example.js\n```\n\nThough for the latter you need to have `INTENTO_API_KEY` in your environment.\n\n## How to pass your API keys to your environment\n\n### zero option (dev only)\n\nHardcode your keys in the script your are experimenting with :)\n\n### 1st option\n\nFor Unix-like machines run:\n\n```bash\nINTENTO_API_KEY=YOUR_SECRET_KEY GOOGLE_API_KEY=YOUR_GOOGLE_API_KEY node example.js\n```\n\nFor Windows machines run:\n\n```bash\nSET INTENTO_API_KEY=YOUR_SECRET_KEY GOOGLE_API_KEY=YOUR_GOOGLE_API_KEY node example.js\n```\n\n### 2nd option\n\nAssuming your are in `intento-nodejs` folder run:\n\n```bash\ncp .env.example .env\n```\n\nThen edit `.env`, **put your api keys there**.\n\nMake that environmental variables available in the current context\n\n```bash\nexport $(cat .env) # once per terminal\n```\n\nRun `example.js` script\n\n```bash\nnode example.js\n```\n\n### 3rd option\n\nUse your favorite \"env\" package like `dotenv` or `node-env-file`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintento%2Fintento-nodejs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fintento%2Fintento-nodejs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintento%2Fintento-nodejs/lists"}