@sharpapi/sharpapi-node-product-description 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +479 -0
- package/package.json +40 -0
- package/src/SharpApiProductDescriptionService.js +30 -0
- package/src/index.js +6 -0
package/README.md
ADDED
|
@@ -0,0 +1,479 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
# Product Description Generator API for Node.js
|
|
4
|
+
|
|
5
|
+
## 🛍️ Generate compelling product descriptions with AI — powered by SharpAPI.
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/@sharpapi/sharpapi-node-product-description)
|
|
8
|
+
[](https://github.com/sharpapi/sharpapi-node-client/blob/master/LICENSE.md)
|
|
9
|
+
|
|
10
|
+
**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.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## 📋 Table of Contents
|
|
15
|
+
|
|
16
|
+
1. [Requirements](#requirements)
|
|
17
|
+
2. [Installation](#installation)
|
|
18
|
+
3. [Usage](#usage)
|
|
19
|
+
4. [API Documentation](#api-documentation)
|
|
20
|
+
5. [Response Format](#response-format)
|
|
21
|
+
6. [Examples](#examples)
|
|
22
|
+
7. [License](#license)
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Requirements
|
|
27
|
+
|
|
28
|
+
- Node.js >= 16.x
|
|
29
|
+
- npm or yarn
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Installation
|
|
34
|
+
|
|
35
|
+
### Step 1. Install the package via npm:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm install @sharpapi/sharpapi-node-product-description
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Step 2. Get your API key
|
|
42
|
+
|
|
43
|
+
Visit [SharpAPI.com](https://sharpapi.com/) to get your API key.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Usage
|
|
48
|
+
|
|
49
|
+
```javascript
|
|
50
|
+
const { SharpApiProductDescriptionService } = require('@sharpapi/sharpapi-node-product-description');
|
|
51
|
+
|
|
52
|
+
const apiKey = process.env.SHARP_API_KEY;
|
|
53
|
+
const service = new SharpApiProductDescriptionService(apiKey);
|
|
54
|
+
|
|
55
|
+
const productData = `
|
|
56
|
+
Product: Wireless Bluetooth Headphones
|
|
57
|
+
Brand: AudioTech Pro
|
|
58
|
+
Model: ATP-X500
|
|
59
|
+
Features:
|
|
60
|
+
- Active Noise Cancellation (ANC)
|
|
61
|
+
- 40-hour battery life
|
|
62
|
+
- Hi-Res Audio certified
|
|
63
|
+
- Comfortable over-ear design
|
|
64
|
+
- Foldable for travel
|
|
65
|
+
- USB-C fast charging
|
|
66
|
+
- Multi-device connectivity
|
|
67
|
+
Price: $199.99
|
|
68
|
+
`;
|
|
69
|
+
|
|
70
|
+
async function generateDescription() {
|
|
71
|
+
try {
|
|
72
|
+
const statusUrl = await service.generateProductDescription(
|
|
73
|
+
productData,
|
|
74
|
+
'English',
|
|
75
|
+
500,
|
|
76
|
+
'Professional',
|
|
77
|
+
'Emphasize premium quality and value'
|
|
78
|
+
);
|
|
79
|
+
console.log('Job submitted. Status URL:', statusUrl);
|
|
80
|
+
|
|
81
|
+
const result = await service.fetchResults(statusUrl);
|
|
82
|
+
const description = result.getResultJson();
|
|
83
|
+
|
|
84
|
+
console.log('Product Description:');
|
|
85
|
+
console.log(description.result.description);
|
|
86
|
+
} catch (error) {
|
|
87
|
+
console.error('Error:', error.message);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
generateDescription();
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## API Documentation
|
|
97
|
+
|
|
98
|
+
### Methods
|
|
99
|
+
|
|
100
|
+
#### `generateProductDescription(productData: string, language?: string, maxLength?: number, voiceTone?: string, context?: string): Promise<string>`
|
|
101
|
+
|
|
102
|
+
Generates a professional product description from product data.
|
|
103
|
+
|
|
104
|
+
**Parameters:**
|
|
105
|
+
- `productData` (string, required): Product details, features, and specifications
|
|
106
|
+
- `language` (string, optional): Output language (default: 'English')
|
|
107
|
+
- `maxLength` (number, optional): Maximum character length (soft limit)
|
|
108
|
+
- `voiceTone` (string, optional): Writing style (e.g., 'Professional', 'Casual', 'Luxury', 'Technical')
|
|
109
|
+
- `context` (string, optional): Additional instructions for the AI
|
|
110
|
+
|
|
111
|
+
**Returns:**
|
|
112
|
+
- Promise<string>: Status URL for polling the job result
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## Response Format
|
|
117
|
+
|
|
118
|
+
The API returns a generated product description:
|
|
119
|
+
|
|
120
|
+
```json
|
|
121
|
+
{
|
|
122
|
+
"data": {
|
|
123
|
+
"type": "api_job_result",
|
|
124
|
+
"id": "8f2a1b5c-9e4d-4a3b-8c7f-6d5e4f3a2b1c",
|
|
125
|
+
"attributes": {
|
|
126
|
+
"status": "success",
|
|
127
|
+
"type": "ecommerce_product_description",
|
|
128
|
+
"result": {
|
|
129
|
+
"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."
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## Examples
|
|
139
|
+
|
|
140
|
+
### Basic Product Description Generation
|
|
141
|
+
|
|
142
|
+
```javascript
|
|
143
|
+
const { SharpApiProductDescriptionService } = require('@sharpapi/sharpapi-node-product-description');
|
|
144
|
+
|
|
145
|
+
const service = new SharpApiProductDescriptionService(process.env.SHARP_API_KEY);
|
|
146
|
+
|
|
147
|
+
const product = `
|
|
148
|
+
Organic Cotton T-Shirt
|
|
149
|
+
Material: 100% organic cotton
|
|
150
|
+
Colors: White, Black, Navy, Gray
|
|
151
|
+
Sizes: XS-XXL
|
|
152
|
+
Features: Breathable, soft, pre-shrunk
|
|
153
|
+
Price: $29.99
|
|
154
|
+
`;
|
|
155
|
+
|
|
156
|
+
service.generateProductDescription(product, 'English', 300, 'Casual')
|
|
157
|
+
.then(statusUrl => service.fetchResults(statusUrl))
|
|
158
|
+
.then(result => {
|
|
159
|
+
const data = result.getResultJson();
|
|
160
|
+
console.log('Generated Description:');
|
|
161
|
+
console.log(data.result.description);
|
|
162
|
+
})
|
|
163
|
+
.catch(error => console.error('Generation failed:', error));
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Batch Product Description Generation
|
|
167
|
+
|
|
168
|
+
```javascript
|
|
169
|
+
const service = new SharpApiProductDescriptionService(process.env.SHARP_API_KEY);
|
|
170
|
+
|
|
171
|
+
const products = [
|
|
172
|
+
{
|
|
173
|
+
id: 'PROD-001',
|
|
174
|
+
data: 'Stainless Steel Water Bottle, 32oz, Insulated, BPA-free, $24.99',
|
|
175
|
+
tone: 'eco-friendly'
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
id: 'PROD-002',
|
|
179
|
+
data: 'Yoga Mat, Non-slip, 6mm thick, Eco-friendly TPE material, $39.99',
|
|
180
|
+
tone: 'wellness'
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
id: 'PROD-003',
|
|
184
|
+
data: 'LED Desk Lamp, Adjustable brightness, USB charging port, Touch control, $49.99',
|
|
185
|
+
tone: 'professional'
|
|
186
|
+
}
|
|
187
|
+
];
|
|
188
|
+
|
|
189
|
+
async function generateAllDescriptions(products) {
|
|
190
|
+
const generated = await Promise.all(
|
|
191
|
+
products.map(async (product) => {
|
|
192
|
+
try {
|
|
193
|
+
const statusUrl = await service.generateProductDescription(
|
|
194
|
+
product.data,
|
|
195
|
+
'English',
|
|
196
|
+
250,
|
|
197
|
+
product.tone
|
|
198
|
+
);
|
|
199
|
+
const result = await service.fetchResults(statusUrl);
|
|
200
|
+
const description = result.getResultJson();
|
|
201
|
+
|
|
202
|
+
return {
|
|
203
|
+
productId: product.id,
|
|
204
|
+
description: description.result.description,
|
|
205
|
+
success: true
|
|
206
|
+
};
|
|
207
|
+
} catch (error) {
|
|
208
|
+
return {
|
|
209
|
+
productId: product.id,
|
|
210
|
+
error: error.message,
|
|
211
|
+
success: false
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
})
|
|
215
|
+
);
|
|
216
|
+
|
|
217
|
+
return generated;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
const results = await generateAllDescriptions(products);
|
|
221
|
+
results.forEach(r => {
|
|
222
|
+
if (r.success) {
|
|
223
|
+
console.log(`\n${r.productId}:`);
|
|
224
|
+
console.log(r.description);
|
|
225
|
+
} else {
|
|
226
|
+
console.error(`Failed ${r.productId}:`, r.error);
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### E-commerce Platform Integration
|
|
232
|
+
|
|
233
|
+
```javascript
|
|
234
|
+
const service = new SharpApiProductDescriptionService(process.env.SHARP_API_KEY);
|
|
235
|
+
|
|
236
|
+
async function enrichProductListing(product) {
|
|
237
|
+
// Compile product data
|
|
238
|
+
const productData = `
|
|
239
|
+
Product Name: ${product.name}
|
|
240
|
+
Brand: ${product.brand}
|
|
241
|
+
Category: ${product.category}
|
|
242
|
+
Price: $${product.price}
|
|
243
|
+
Key Features: ${product.features.join(', ')}
|
|
244
|
+
Specifications: ${product.specs}
|
|
245
|
+
Target Audience: ${product.targetAudience}
|
|
246
|
+
`;
|
|
247
|
+
|
|
248
|
+
// Generate description with appropriate tone
|
|
249
|
+
const voiceTone = product.category === 'Luxury' ? 'Sophisticated' :
|
|
250
|
+
product.category === 'Tech' ? 'Technical' :
|
|
251
|
+
product.category === 'Kids' ? 'Fun and playful' :
|
|
252
|
+
'Professional';
|
|
253
|
+
|
|
254
|
+
const statusUrl = await service.generateProductDescription(
|
|
255
|
+
productData,
|
|
256
|
+
'English',
|
|
257
|
+
600,
|
|
258
|
+
voiceTone,
|
|
259
|
+
`Highlight ${product.usp || 'unique selling points'}`
|
|
260
|
+
);
|
|
261
|
+
|
|
262
|
+
const result = await service.fetchResults(statusUrl);
|
|
263
|
+
const generated = result.getResultJson();
|
|
264
|
+
|
|
265
|
+
return {
|
|
266
|
+
...product,
|
|
267
|
+
description: generated.result.description,
|
|
268
|
+
seoOptimized: true,
|
|
269
|
+
lastUpdated: new Date().toISOString()
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
const product = {
|
|
274
|
+
id: 'SKU-12345',
|
|
275
|
+
name: 'Smart Fitness Tracker',
|
|
276
|
+
brand: 'FitPro',
|
|
277
|
+
category: 'Tech',
|
|
278
|
+
price: 79.99,
|
|
279
|
+
features: ['Heart rate monitor', 'Sleep tracking', 'Waterproof', '7-day battery'],
|
|
280
|
+
specs: 'AMOLED display, Bluetooth 5.0, Compatible with iOS and Android',
|
|
281
|
+
targetAudience: 'Health-conscious individuals',
|
|
282
|
+
usp: 'Advanced health metrics and long battery life'
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
const enrichedProduct = await enrichProductListing(product);
|
|
286
|
+
console.log('Enriched Product:', enrichedProduct);
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
### Multilingual Product Descriptions
|
|
290
|
+
|
|
291
|
+
```javascript
|
|
292
|
+
const service = new SharpApiProductDescriptionService(process.env.SHARP_API_KEY);
|
|
293
|
+
|
|
294
|
+
async function generateMultilingual(productData, languages) {
|
|
295
|
+
const descriptions = {};
|
|
296
|
+
|
|
297
|
+
for (const lang of languages) {
|
|
298
|
+
const statusUrl = await service.generateProductDescription(
|
|
299
|
+
productData,
|
|
300
|
+
lang,
|
|
301
|
+
400,
|
|
302
|
+
'Professional'
|
|
303
|
+
);
|
|
304
|
+
const result = await service.fetchResults(statusUrl);
|
|
305
|
+
const generated = result.getResultJson();
|
|
306
|
+
|
|
307
|
+
descriptions[lang] = generated.result.description;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
return descriptions;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
const product = `
|
|
314
|
+
Premium Leather Wallet
|
|
315
|
+
Material: Genuine Italian leather
|
|
316
|
+
Features: RFID blocking, 8 card slots, coin pocket
|
|
317
|
+
Dimensions: 4.5" x 3.5" x 0.5"
|
|
318
|
+
Price: $89.99
|
|
319
|
+
`;
|
|
320
|
+
|
|
321
|
+
const languages = ['English', 'Spanish', 'French', 'German'];
|
|
322
|
+
const multilingualDescriptions = await generateMultilingual(product, languages);
|
|
323
|
+
|
|
324
|
+
Object.entries(multilingualDescriptions).forEach(([lang, desc]) => {
|
|
325
|
+
console.log(`\n${lang}:`);
|
|
326
|
+
console.log(desc);
|
|
327
|
+
});
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
### Dropshipping Automation
|
|
331
|
+
|
|
332
|
+
```javascript
|
|
333
|
+
const service = new SharpApiProductDescriptionService(process.env.SHARP_API_KEY);
|
|
334
|
+
|
|
335
|
+
async function processSupplierFeed(supplierProducts) {
|
|
336
|
+
const processed = [];
|
|
337
|
+
|
|
338
|
+
for (const item of supplierProducts) {
|
|
339
|
+
// Clean and enhance supplier data
|
|
340
|
+
const productData = `
|
|
341
|
+
${item.title}
|
|
342
|
+
${item.bullet_points.join('\n')}
|
|
343
|
+
Price: $${item.price}
|
|
344
|
+
${item.technical_specs || ''}
|
|
345
|
+
`;
|
|
346
|
+
|
|
347
|
+
const statusUrl = await service.generateProductDescription(
|
|
348
|
+
productData,
|
|
349
|
+
'English',
|
|
350
|
+
500,
|
|
351
|
+
'Engaging',
|
|
352
|
+
'Focus on benefits, not just features'
|
|
353
|
+
);
|
|
354
|
+
|
|
355
|
+
const result = await service.fetchResults(statusUrl);
|
|
356
|
+
const generated = result.getResultJson();
|
|
357
|
+
|
|
358
|
+
processed.push({
|
|
359
|
+
supplierId: item.id,
|
|
360
|
+
originalTitle: item.title,
|
|
361
|
+
enhancedDescription: generated.result.description,
|
|
362
|
+
price: item.price,
|
|
363
|
+
importDate: new Date().toISOString()
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
return processed;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
const supplierFeed = [
|
|
371
|
+
{
|
|
372
|
+
id: 'SUP-789',
|
|
373
|
+
title: 'USB-C Hub 7-in-1',
|
|
374
|
+
bullet_points: [
|
|
375
|
+
'3x USB 3.0 ports',
|
|
376
|
+
'HDMI 4K output',
|
|
377
|
+
'SD/TF card reader',
|
|
378
|
+
'USB-C power delivery'
|
|
379
|
+
],
|
|
380
|
+
price: 34.99
|
|
381
|
+
}
|
|
382
|
+
];
|
|
383
|
+
|
|
384
|
+
const processedProducts = await processSupplierFeed(supplierFeed);
|
|
385
|
+
console.log('Processed Products:', processedProducts);
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
---
|
|
389
|
+
|
|
390
|
+
## Use Cases
|
|
391
|
+
|
|
392
|
+
- **E-commerce Stores**: Auto-generate descriptions for new products
|
|
393
|
+
- **Dropshipping**: Transform supplier data into unique descriptions
|
|
394
|
+
- **Product Catalogs**: Populate large inventories quickly
|
|
395
|
+
- **Marketplaces**: Create consistent descriptions across listings
|
|
396
|
+
- **Content Marketing**: Generate SEO-optimized product content
|
|
397
|
+
- **Translation Services**: Create multilingual product pages
|
|
398
|
+
- **Bulk Import**: Process hundreds of products automatically
|
|
399
|
+
- **A/B Testing**: Generate multiple description variants
|
|
400
|
+
|
|
401
|
+
---
|
|
402
|
+
|
|
403
|
+
## Writing Tones
|
|
404
|
+
|
|
405
|
+
Customize descriptions with voice_tone parameter:
|
|
406
|
+
|
|
407
|
+
- **Professional**: Business-like, straightforward
|
|
408
|
+
- **Casual**: Friendly, conversational
|
|
409
|
+
- **Luxury**: Sophisticated, premium
|
|
410
|
+
- **Technical**: Detailed, spec-focused
|
|
411
|
+
- **Playful**: Fun, energetic
|
|
412
|
+
- **Minimalist**: Clean, concise
|
|
413
|
+
- **Storytelling**: Narrative-driven
|
|
414
|
+
- **Eco-friendly**: Sustainability-focused
|
|
415
|
+
|
|
416
|
+
---
|
|
417
|
+
|
|
418
|
+
## Best Practices
|
|
419
|
+
|
|
420
|
+
### Input Data Quality
|
|
421
|
+
|
|
422
|
+
Provide comprehensive product information:
|
|
423
|
+
- Product name and brand
|
|
424
|
+
- Key features and benefits
|
|
425
|
+
- Technical specifications
|
|
426
|
+
- Materials and dimensions
|
|
427
|
+
- Price point and target audience
|
|
428
|
+
- Unique selling propositions
|
|
429
|
+
|
|
430
|
+
### Length Guidelines
|
|
431
|
+
|
|
432
|
+
- **Short (150-250 chars)**: Product cards, thumbnails
|
|
433
|
+
- **Medium (250-500 chars)**: Category pages, listings
|
|
434
|
+
- **Long (500-1000 chars)**: Product detail pages, full descriptions
|
|
435
|
+
|
|
436
|
+
### SEO Optimization
|
|
437
|
+
|
|
438
|
+
- Include relevant keywords in product data
|
|
439
|
+
- Specify target audience in context
|
|
440
|
+
- Request benefit-focused language
|
|
441
|
+
- Ask for natural keyword integration
|
|
442
|
+
|
|
443
|
+
---
|
|
444
|
+
|
|
445
|
+
## API Endpoint
|
|
446
|
+
|
|
447
|
+
**POST** `/ecommerce/product_description`
|
|
448
|
+
|
|
449
|
+
For detailed API specifications, refer to:
|
|
450
|
+
- [Main API Documentation](https://documenter.getpostman.com/view/31106842/2s9Ye8faUp)
|
|
451
|
+
- [Product Page](https://sharpapi.com/en/catalog/ai/e-commerce)
|
|
452
|
+
|
|
453
|
+
---
|
|
454
|
+
|
|
455
|
+
## Related Packages
|
|
456
|
+
|
|
457
|
+
- [@sharpapi/sharpapi-node-product-intro](https://www.npmjs.com/package/@sharpapi/sharpapi-node-product-intro) - Short product intros
|
|
458
|
+
- [@sharpapi/sharpapi-node-product-categories](https://www.npmjs.com/package/@sharpapi/sharpapi-node-product-categories) - Product categorization
|
|
459
|
+
- [@sharpapi/sharpapi-node-product-review-sentiment](https://www.npmjs.com/package/@sharpapi/sharpapi-node-product-review-sentiment) - Review analysis
|
|
460
|
+
- [@sharpapi/sharpapi-node-thank-you-email](https://www.npmjs.com/package/@sharpapi/sharpapi-node-thank-you-email) - Customer emails
|
|
461
|
+
- [@sharpapi/sharpapi-node-client](https://www.npmjs.com/package/@sharpapi/sharpapi-node-client) - Full SharpAPI SDK
|
|
462
|
+
|
|
463
|
+
---
|
|
464
|
+
|
|
465
|
+
## License
|
|
466
|
+
|
|
467
|
+
This project is licensed under the MIT License. See the [LICENSE.md](LICENSE.md) file for details.
|
|
468
|
+
|
|
469
|
+
---
|
|
470
|
+
|
|
471
|
+
## Support
|
|
472
|
+
|
|
473
|
+
- **Documentation**: [SharpAPI.com Documentation](https://sharpapi.com/documentation)
|
|
474
|
+
- **Issues**: [GitHub Issues](https://github.com/sharpapi/sharpapi-node-client/issues)
|
|
475
|
+
- **Email**: contact@sharpapi.com
|
|
476
|
+
|
|
477
|
+
---
|
|
478
|
+
|
|
479
|
+
**Powered by [SharpAPI](https://sharpapi.com/) - AI-Powered API Workflow Automation**
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sharpapi/sharpapi-node-product-description",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "SharpAPI.com Node.js SDK for generating product descriptions",
|
|
5
|
+
"main": "src/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "jest"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [
|
|
10
|
+
"sharpapi",
|
|
11
|
+
"ai-powered",
|
|
12
|
+
"ai capabilities",
|
|
13
|
+
"api",
|
|
14
|
+
"ai api",
|
|
15
|
+
"api integration",
|
|
16
|
+
"artificial intelligence",
|
|
17
|
+
"natural language processing",
|
|
18
|
+
"restful api",
|
|
19
|
+
"nodejs",
|
|
20
|
+
"software development",
|
|
21
|
+
"e-commerce",
|
|
22
|
+
"product description",
|
|
23
|
+
"content generation"
|
|
24
|
+
],
|
|
25
|
+
"author": "Dawid Makowski <contact@sharpapi.com>",
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@sharpapi/sharpapi-node-core": "file:../sharpapi-node-core"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"jest": "^29.7.0"
|
|
32
|
+
},
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public"
|
|
35
|
+
},
|
|
36
|
+
"repository": {
|
|
37
|
+
"type": "git",
|
|
38
|
+
"url": "https://github.com/sharpapi/sharpapi-node-product-description.git"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const { SharpApiCoreService, SharpApiJobTypeEnum } = require('@sharpapi/sharpapi-node-core');
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Service for generating product descriptions using SharpAPI.com
|
|
5
|
+
*/
|
|
6
|
+
class SharpApiProductDescriptionService extends SharpApiCoreService {
|
|
7
|
+
/**
|
|
8
|
+
* Generates a professional product description based on the provided product data.
|
|
9
|
+
* Perfect for e-commerce platforms, product catalogs, and marketing materials.
|
|
10
|
+
*
|
|
11
|
+
* @param {string} productData - Product details and key information
|
|
12
|
+
* @param {string|null} language - Output language (default: English)
|
|
13
|
+
* @param {number|null} maxLength - Maximum character length
|
|
14
|
+
* @param {string|null} voiceTone - Tone of the description (e.g., 'Professional', 'Casual')
|
|
15
|
+
* @param {string|null} context - Additional context for the AI
|
|
16
|
+
* @returns {Promise<string>} - The status URL.
|
|
17
|
+
*/
|
|
18
|
+
async generateProductDescription(productData, language = null, maxLength = null, voiceTone = null, context = null) {
|
|
19
|
+
const data = { content: productData };
|
|
20
|
+
if (language) data.language = language;
|
|
21
|
+
if (maxLength) data.max_length = maxLength;
|
|
22
|
+
if (voiceTone) data.voice_tone = voiceTone;
|
|
23
|
+
if (context) data.context = context;
|
|
24
|
+
|
|
25
|
+
const response = await this.makeRequest('POST', SharpApiJobTypeEnum.ECOMMERCE_PRODUCT_DESCRIPTION.url, data);
|
|
26
|
+
return this.parseStatusUrl(response);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
module.exports = { SharpApiProductDescriptionService };
|