JSPM

@sharpapi/sharpapi-node-product-description

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5
  • Score
    100M100P100Q33924F
  • License MIT

SharpAPI.com Node.js SDK for generating product descriptions

Package Exports

  • @sharpapi/sharpapi-node-product-description
  • @sharpapi/sharpapi-node-product-description/src/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@sharpapi/sharpapi-node-product-description) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

SharpAPI GitHub cover

Product Description Generator API for Node.js

🛍️ Generate compelling product descriptions with AI — powered by SharpAPI.

npm version License

SharpAPI Product Description Generator creates professional, engaging product descriptions from product data using AI. Perfect for e-commerce platforms, product catalogs, dropshipping businesses, and marketing automation.


📋 Table of Contents

  1. Requirements
  2. Installation
  3. Usage
  4. API Documentation
  5. Response Format
  6. Examples
  7. License

Requirements

  • Node.js >= 16.x
  • npm or yarn

Installation

Step 1. Install the package via npm:

npm install @sharpapi/sharpapi-node-product-description

Step 2. Get your API key

Visit SharpAPI.com to get your API key.


Usage

const { SharpApiProductDescriptionService } = require('@sharpapi/sharpapi-node-product-description');

const apiKey = process.env.SHARP_API_KEY;
const service = new SharpApiProductDescriptionService(apiKey);

const productData = `
Product: Wireless Bluetooth Headphones
Brand: AudioTech Pro
Model: ATP-X500
Features:
- Active Noise Cancellation (ANC)
- 40-hour battery life
- Hi-Res Audio certified
- Comfortable over-ear design
- Foldable for travel
- USB-C fast charging
- Multi-device connectivity
Price: $199.99
`;

async function generateDescription() {
  try {
    const statusUrl = await service.generateProductDescription(
      productData,
      'English',
      500,
      'Professional',
      'Emphasize premium quality and value'
    );
    console.log('Job submitted. Status URL:', statusUrl);

    const result = await service.fetchResults(statusUrl);
    const description = result.getResultJson();

    console.log('Product Description:');
    console.log(description.result.description);
  } catch (error) {
    console.error('Error:', error.message);
  }
}

generateDescription();

API Documentation

Methods

generateProductDescription(productData: string, language?: string, maxLength?: number, voiceTone?: string, context?: string): Promise<string>

Generates a professional product description from product data.

Parameters:

  • productData (string, required): Product details, features, and specifications
  • language (string, optional): Output language (default: 'English')
  • maxLength (number, optional): Maximum character length (soft limit)
  • voiceTone (string, optional): Writing style (e.g., 'Professional', 'Casual', 'Luxury', 'Technical')
  • context (string, optional): Additional instructions for the AI

Returns:

  • Promise: Status URL for polling the job result

Response Format

The API returns a generated product description:

{
  "data": {
    "type": "api_job_result",
    "id": "8f2a1b5c-9e4d-4a3b-8c7f-6d5e4f3a2b1c",
    "attributes": {
      "status": "success",
      "type": "ecommerce_product_description",
      "result": {
        "description": "Experience premium audio quality with the AudioTech Pro ATP-X500 Wireless Bluetooth Headphones. Featuring advanced Active Noise Cancellation technology, these over-ear headphones deliver crystal-clear sound while blocking out distractions. With an impressive 40-hour battery life and Hi-Res Audio certification, enjoy your favorite music, podcasts, and calls without interruption. The comfortable, foldable design makes them perfect for travel, while USB-C fast charging ensures you're always ready to go. Multi-device connectivity lets you seamlessly switch between your phone, tablet, and laptop. Elevate your listening experience with ATP-X500."
      }
    }
  }
}

Examples

Basic Product Description Generation

const { SharpApiProductDescriptionService } = require('@sharpapi/sharpapi-node-product-description');

const service = new SharpApiProductDescriptionService(process.env.SHARP_API_KEY);

const product = `
Organic Cotton T-Shirt
Material: 100% organic cotton
Colors: White, Black, Navy, Gray
Sizes: XS-XXL
Features: Breathable, soft, pre-shrunk
Price: $29.99
`;

service.generateProductDescription(product, 'English', 300, 'Casual')
  .then(statusUrl => service.fetchResults(statusUrl))
  .then(result => {
    const data = result.getResultJson();
    console.log('Generated Description:');
    console.log(data.result.description);
  })
  .catch(error => console.error('Generation failed:', error));

Batch Product Description Generation

const service = new SharpApiProductDescriptionService(process.env.SHARP_API_KEY);

const products = [
  {
    id: 'PROD-001',
    data: 'Stainless Steel Water Bottle, 32oz, Insulated, BPA-free, $24.99',
    tone: 'eco-friendly'
  },
  {
    id: 'PROD-002',
    data: 'Yoga Mat, Non-slip, 6mm thick, Eco-friendly TPE material, $39.99',
    tone: 'wellness'
  },
  {
    id: 'PROD-003',
    data: 'LED Desk Lamp, Adjustable brightness, USB charging port, Touch control, $49.99',
    tone: 'professional'
  }
];

async function generateAllDescriptions(products) {
  const generated = await Promise.all(
    products.map(async (product) => {
      try {
        const statusUrl = await service.generateProductDescription(
          product.data,
          'English',
          250,
          product.tone
        );
        const result = await service.fetchResults(statusUrl);
        const description = result.getResultJson();

        return {
          productId: product.id,
          description: description.result.description,
          success: true
        };
      } catch (error) {
        return {
          productId: product.id,
          error: error.message,
          success: false
        };
      }
    })
  );

  return generated;
}

const results = await generateAllDescriptions(products);
results.forEach(r => {
  if (r.success) {
    console.log(`\n${r.productId}:`);
    console.log(r.description);
  } else {
    console.error(`Failed ${r.productId}:`, r.error);
  }
});

E-commerce Platform Integration

const service = new SharpApiProductDescriptionService(process.env.SHARP_API_KEY);

async function enrichProductListing(product) {
  // Compile product data
  const productData = `
    Product Name: ${product.name}
    Brand: ${product.brand}
    Category: ${product.category}
    Price: $${product.price}
    Key Features: ${product.features.join(', ')}
    Specifications: ${product.specs}
    Target Audience: ${product.targetAudience}
  `;

  // Generate description with appropriate tone
  const voiceTone = product.category === 'Luxury' ? 'Sophisticated' :
                    product.category === 'Tech' ? 'Technical' :
                    product.category === 'Kids' ? 'Fun and playful' :
                    'Professional';

  const statusUrl = await service.generateProductDescription(
    productData,
    'English',
    600,
    voiceTone,
    `Highlight ${product.usp || 'unique selling points'}`
  );

  const result = await service.fetchResults(statusUrl);
  const generated = result.getResultJson();

  return {
    ...product,
    description: generated.result.description,
    seoOptimized: true,
    lastUpdated: new Date().toISOString()
  };
}

const product = {
  id: 'SKU-12345',
  name: 'Smart Fitness Tracker',
  brand: 'FitPro',
  category: 'Tech',
  price: 79.99,
  features: ['Heart rate monitor', 'Sleep tracking', 'Waterproof', '7-day battery'],
  specs: 'AMOLED display, Bluetooth 5.0, Compatible with iOS and Android',
  targetAudience: 'Health-conscious individuals',
  usp: 'Advanced health metrics and long battery life'
};

const enrichedProduct = await enrichProductListing(product);
console.log('Enriched Product:', enrichedProduct);

Multilingual Product Descriptions

const service = new SharpApiProductDescriptionService(process.env.SHARP_API_KEY);

async function generateMultilingual(productData, languages) {
  const descriptions = {};

  for (const lang of languages) {
    const statusUrl = await service.generateProductDescription(
      productData,
      lang,
      400,
      'Professional'
    );
    const result = await service.fetchResults(statusUrl);
    const generated = result.getResultJson();

    descriptions[lang] = generated.result.description;
  }

  return descriptions;
}

const product = `
Premium Leather Wallet
Material: Genuine Italian leather
Features: RFID blocking, 8 card slots, coin pocket
Dimensions: 4.5" x 3.5" x 0.5"
Price: $89.99
`;

const languages = ['English', 'Spanish', 'French', 'German'];
const multilingualDescriptions = await generateMultilingual(product, languages);

Object.entries(multilingualDescriptions).forEach(([lang, desc]) => {
  console.log(`\n${lang}:`);
  console.log(desc);
});

Dropshipping Automation

const service = new SharpApiProductDescriptionService(process.env.SHARP_API_KEY);

async function processSupplierFeed(supplierProducts) {
  const processed = [];

  for (const item of supplierProducts) {
    // Clean and enhance supplier data
    const productData = `
      ${item.title}
      ${item.bullet_points.join('\n')}
      Price: $${item.price}
      ${item.technical_specs || ''}
    `;

    const statusUrl = await service.generateProductDescription(
      productData,
      'English',
      500,
      'Engaging',
      'Focus on benefits, not just features'
    );

    const result = await service.fetchResults(statusUrl);
    const generated = result.getResultJson();

    processed.push({
      supplierId: item.id,
      originalTitle: item.title,
      enhancedDescription: generated.result.description,
      price: item.price,
      importDate: new Date().toISOString()
    });
  }

  return processed;
}

const supplierFeed = [
  {
    id: 'SUP-789',
    title: 'USB-C Hub 7-in-1',
    bullet_points: [
      '3x USB 3.0 ports',
      'HDMI 4K output',
      'SD/TF card reader',
      'USB-C power delivery'
    ],
    price: 34.99
  }
];

const processedProducts = await processSupplierFeed(supplierFeed);
console.log('Processed Products:', processedProducts);

Use Cases

  • E-commerce Stores: Auto-generate descriptions for new products
  • Dropshipping: Transform supplier data into unique descriptions
  • Product Catalogs: Populate large inventories quickly
  • Marketplaces: Create consistent descriptions across listings
  • Content Marketing: Generate SEO-optimized product content
  • Translation Services: Create multilingual product pages
  • Bulk Import: Process hundreds of products automatically
  • A/B Testing: Generate multiple description variants

Writing Tones

Customize descriptions with voice_tone parameter:

  • Professional: Business-like, straightforward
  • Casual: Friendly, conversational
  • Luxury: Sophisticated, premium
  • Technical: Detailed, spec-focused
  • Playful: Fun, energetic
  • Minimalist: Clean, concise
  • Storytelling: Narrative-driven
  • Eco-friendly: Sustainability-focused

Best Practices

Input Data Quality

Provide comprehensive product information:

  • Product name and brand
  • Key features and benefits
  • Technical specifications
  • Materials and dimensions
  • Price point and target audience
  • Unique selling propositions

Length Guidelines

  • Short (150-250 chars): Product cards, thumbnails
  • Medium (250-500 chars): Category pages, listings
  • Long (500-1000 chars): Product detail pages, full descriptions

SEO Optimization

  • Include relevant keywords in product data
  • Specify target audience in context
  • Request benefit-focused language
  • Ask for natural keyword integration

API Endpoint

POST /ecommerce/product_description

For detailed API specifications, refer to:



License

This project is licensed under the MIT License. See the LICENSE.md file for details.


Support


Powered by SharpAPI - AI-Powered API Workflow Automation