SharpAPI NodeJS Client SDK
🚀 Automate workflows with AI-powered API
Leverage AI API to streamline workflows in E-Commerce, Marketing, Content Management, HR Tech, Travel, and more.
SharpAPI.com Node.js SDK Client is an AI-powered workflow automation API that enables developers to integrate advanced artificial intelligence capabilities into their Node.js applications. This SDK simplifies interaction with the SharpAPI services, providing a seamless way to leverage AI for various use cases.
See more at SharpAPI.com Website »
Requirements
Installation
npm i @sharpapi/sharpapi-node-client
Table of Contents
- Installation
- Configuration
- Usage
- Examples
- Testing
- Contributing
- License
Installation
Prerequisites
- Node.js v14 or higher
- npm (Node Package Manager)
Install via npm
You can install the SharpAPI Node.js SDK Client using npm:
npm install @sharpapi/sharpapi-node-client
Install via Yarn
Alternatively, if you prefer using Yarn:
yarn add @sharpapi/sharpapi-node-client
Configuration
Setting Up Environment Variables
To protect your credentials, it's recommended to use a .env
file to store your SharpAPI API key. Follow these steps:
-
Create a .env
File
In the root directory of your project, create a file named .env
:
SHARP_API_KEY=your_actual_api_key_here
-
Install dotenv
Package
To load environment variables from the .env
file, install the dotenv
package:
npm install dotenv
-
Load Environment Variables
At the beginning of your application (e.g., in app.js
or index.js
), add the following line to load the environment variables:
require('dotenv').config();
-
Ensure .env
is Ignored
Add .env
to your .gitignore
file to prevent sensitive information from being committed to version control:
# .gitignore
.env
Usage
Initialization
First, import and initialize the SharpApiService
with your API key:
require('dotenv').config();
const { SharpApiService } = require('@sharpapi/sharpapi-node-client');
const apiKey = process.env.SHARP_API_KEY;
const sharpApi = new SharpApiService(apiKey);
Available Methods
The SharpApiService
class provides various methods to interact with SharpAPI endpoints. Below is a list of available methods along with their descriptions:
- ping()
- quota()
- parseResume(filePath, language)
- generateJobDescription(jobDescriptionParameters)
- Description: Generates a job description based on provided parameters.
- Parameters:
jobDescriptionParameters
(JobDescriptionParameters): Object containing job details.
- Usage:
const { JobDescriptionParameters } = require('@sharpapi/sharpapi-node-client');
const jobDescriptionParams = new JobDescriptionParameters(
"Software Engineer",
"Tech Corp",
["Develop applications", "Collaborate with teams"],
["Proficiency in JavaScript", "Experience with APIs"],
"English",
"Professional",
null
);
const statusUrl = await sharpApi.generateJobDescription(jobDescriptionParams);
const resultJob = await sharpApi.fetchResults(statusUrl);
console.log(resultJob.getResultJson());
- relatedSkills(skillName, language, maxQuantity)
- relatedJobPositions(jobPositionName, language, maxQuantity)
- productReviewSentiment(review)
- productCategories(productName, language, maxQuantity, voiceTone, context)
- Description: Generates suitable categories for a given product.
- Parameters:
productName
(string): Name of the product.language
(string, optional): Language of the response (default: 'English').maxQuantity
(number, optional): Maximum number of categories to generate.voiceTone
(string, optional): Tone of the voice in the response (e.g., 'Neutral').context
(string, optional): Additional context for category generation.
- Usage:
const statusUrl = await sharpApi.productCategories("Smartphone", "English", 5, "Neutral", null);
const resultJob = await sharpApi.fetchResults(statusUrl);
console.log(resultJob.getResultJson());
- generateProductIntro(productData, language, maxLength, voiceTone)
- Description: Generates a marketing introduction for a product.
- Parameters:
productData
(string): Detailed description of the product.language
(string, optional): Language of the response (default: 'English').maxLength
(number, optional): Maximum length of the introduction.voiceTone
(string, optional): Tone of the voice in the response (e.g., 'Friendly').
- Usage:
const statusUrl = await sharpApi.generateProductIntro("This smartphone features...", "English", 100, "Friendly");
const resultJob = await sharpApi.fetchResults(statusUrl);
console.log(resultJob.getResultJson());
- generateThankYouEmail(productName, language, maxLength, voiceTone, context)
- Description: Generates a personalized thank-you email for customers.
- Parameters:
productName
(string): Name of the purchased product.language
(string, optional): Language of the email (default: 'English').maxLength
(number, optional): Maximum length of the email.voiceTone
(string, optional): Tone of the voice in the email (e.g., 'Professional').context
(string, optional): Additional context for the email generation.
- Usage:
const statusUrl = await sharpApi.generateThankYouEmail("Smartphone", "English", 200, "Professional", null);
const resultJob = await sharpApi.fetchResults(statusUrl);
console.log(resultJob.getResultJson());
- detectPhones(text)
- detectEmails(text)
- detectSpam(text)
- summarizeText(text, language, maxLength, voiceTone, context)
- Description: Generates a summarized version of the provided text.
- Parameters:
text
(string): The text to summarize.language
(string, optional): Language of the summary (default: 'English').maxLength
(number, optional): Maximum length of the summary.voiceTone
(string, optional): Tone of the voice in the summary (e.g., 'Neutral').context
(string, optional): Additional context for the summarization.
- Usage:
const statusUrl = await sharpApi.summarizeText("Long article text...", "English", 50, "Neutral", null);
const resultJob = await sharpApi.fetchResults(statusUrl);
console.log(resultJob.getResultJson());
- generateKeywords(text, language, maxQuantity, voiceTone, context)
- Description: Generates a list of keywords based on the provided content.
- Parameters:
text
(string): The content to extract keywords from.language
(string, optional): Language of the keywords (default: 'English').maxQuantity
(number, optional): Maximum number of keywords to generate.voiceTone
(string, optional): Tone of the voice in the keywords (e.g., 'Neutral').context
(string, optional): Additional context for keyword generation.
- Usage:
const statusUrl = await sharpApi.generateKeywords("Content for keyword extraction...", "English", 5, "Neutral", null);
const resultJob = await sharpApi.fetchResults(statusUrl);
console.log(resultJob.getResultJson());
- translate(text, language, voiceTone, context)
- Description: Translates the provided text into the specified language.
- Parameters:
text
(string): The text to translate.language
(string): The target language for translation (e.g., 'Spanish').voiceTone
(string, optional): Tone of the voice in the translation (e.g., 'Neutral').context
(string, optional): Additional context for translation.
- Usage:
const statusUrl = await sharpApi.translate("Hello, world!", "Spanish", "Neutral", null);
const resultJob = await sharpApi.fetchResults(statusUrl);
console.log(resultJob.getResultJson());
- paraphrase(text, language, maxLength, voiceTone, context)
- Description: Generates a paraphrased version of the provided text.
- Parameters:
text
(string): The text to paraphrase.language
(string, optional): Language of the paraphrase (default: 'English').maxLength
(number, optional): Maximum length of the paraphrased text.voiceTone
(string, optional): Tone of the voice in the paraphrase (e.g., 'Neutral').context
(string, optional): Additional context for paraphrasing.
- Usage:
const statusUrl = await sharpApi.paraphrase("Original text to paraphrase.", "English", 100, "Neutral", null);
const resultJob = await sharpApi.fetchResults(statusUrl);
console.log(resultJob.getResultJson());
- proofread(text)
- generateSeoTags(text, language, voiceTone)
- Description: Generates META tags based on the provided content.
- Parameters:
text
(string): The content to generate SEO tags from.language
(string, optional): Language of the SEO tags (default: 'English').voiceTone
(string, optional): Tone of the voice in the SEO tags (e.g., 'Neutral').
- Usage:
const statusUrl = await sharpApi.generateSeoTags("Content for SEO tag generation.", "English", "Neutral");
const resultJob = await sharpApi.fetchResults(statusUrl);
console.log(resultJob.getResultJson());
- travelReviewSentiment(text)
- toursAndActivitiesProductCategories(productName, city, country, language, maxQuantity, voiceTone, context)
- Description: Generates suitable categories for Tours & Activities products.
- Parameters:
productName
(string): Name of the product.city
(string, optional): City related to the product.country
(string, optional): Country related to the product.language
(string, optional): Language of the response (default: 'English').maxQuantity
(number, optional): Maximum number of categories to generate.voiceTone
(string, optional): Tone of the voice in the response (e.g., 'Neutral').context
(string, optional): Additional context for category generation.
- Usage:
const statusUrl = await sharpApi.toursAndActivitiesProductCategories(
"City Tour",
"Paris",
"France",
"English",
5,
"Neutral",
null
);
const resultJob = await sharpApi.fetchResults(statusUrl);
console.log(resultJob.getResultJson());
- hospitalityProductCategories(productName, city, country, language, maxQuantity, voiceTone, context)
- Description: Generates suitable categories for Hospitality products.
- Parameters:
productName
(string): Name of the product.city
(string, optional): City related to the product.country
(string, optional): Country related to the product.language
(string, optional): Language of the response (default: 'English').maxQuantity
(number, optional): Maximum number of categories to generate.voiceTone
(string, optional): Tone of the voice in the response (e.g., 'Neutral').context
(string, optional): Additional context for category generation.
- Usage:
const statusUrl = await sharpApi.hospitalityProductCategories(
"Luxury Hotel",
"New York",
"USA",
"English",
5,
"Neutral",
null
);
const resultJob = await sharpApi.fetchResults(statusUrl);
console.log(resultJob.getResultJson());
API Documentation
For detailed usage and API methods, please refer to the SharpAPI.com Documentation.
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Check CONTRIBUTION.md file for details.
License
This project is licensed under the MIT License.
Support
If you encounter any issues or have questions, feel free to open an issue on the GitHub repository or contact support at contact@sharpapi.com.
Happy Coding with SharpAPI Node.js SDK Client!