@sharpapi/sharpapi-node-product-intro 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 +281 -0
- package/package.json +40 -0
- package/src/SharpApiProductIntroService.js +29 -0
- package/src/index.js +6 -0
package/README.md
ADDED
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
# Product Intro Generator API for Node.js
|
|
4
|
+
|
|
5
|
+
## 🛍️ Generate compelling product introductions — powered by SharpAPI AI.
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/@sharpapi/sharpapi-node-product-intro)
|
|
8
|
+
[](https://github.com/sharpapi/sharpapi-node-client/blob/master/LICENSE.md)
|
|
9
|
+
|
|
10
|
+
**SharpAPI Product Intro Generator** creates engaging, conversion-focused product introductions that highlight key features and benefits. Perfect for e-commerce, marketing, and product pages.
|
|
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. [Examples](#examples)
|
|
21
|
+
6. [License](#license)
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Requirements
|
|
26
|
+
|
|
27
|
+
- Node.js >= 16.x
|
|
28
|
+
- npm or yarn
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
|
|
34
|
+
### Step 1. Install the package via npm:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npm install @sharpapi/sharpapi-node-product-intro
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Step 2. Get your API key
|
|
41
|
+
|
|
42
|
+
Visit [SharpAPI.com](https://sharpapi.com/) to get your API key.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Usage
|
|
47
|
+
|
|
48
|
+
```javascript
|
|
49
|
+
const { SharpApiProductIntroService } = require('@sharpapi/sharpapi-node-product-intro');
|
|
50
|
+
|
|
51
|
+
const apiKey = process.env.SHARP_API_KEY; // Store your API key in environment variables
|
|
52
|
+
const service = new SharpApiProductIntroService(apiKey);
|
|
53
|
+
|
|
54
|
+
const productName = 'Wireless RGB Gaming Mouse';
|
|
55
|
+
const features = [
|
|
56
|
+
'16000 DPI optical sensor',
|
|
57
|
+
'Customizable RGB lighting',
|
|
58
|
+
'Ergonomic design',
|
|
59
|
+
'8 programmable buttons'
|
|
60
|
+
];
|
|
61
|
+
|
|
62
|
+
async function generateIntro() {
|
|
63
|
+
try {
|
|
64
|
+
// Submit intro generation job
|
|
65
|
+
const statusUrl = await service.generateProductIntro(productName, features, 'English');
|
|
66
|
+
console.log('Job submitted. Status URL:', statusUrl);
|
|
67
|
+
|
|
68
|
+
// Fetch results (polls automatically until complete)
|
|
69
|
+
const result = await service.fetchResults(statusUrl);
|
|
70
|
+
console.log('Generated intro:', result.getResultJson());
|
|
71
|
+
} catch (error) {
|
|
72
|
+
console.error('Error:', error.message);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
generateIntro();
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## API Documentation
|
|
82
|
+
|
|
83
|
+
### Methods
|
|
84
|
+
|
|
85
|
+
#### `generateProductIntro(productName: string, features: string[], language?: string, voiceTone?: string, context?: string, maxLength?: number): Promise<string>`
|
|
86
|
+
|
|
87
|
+
Generates a compelling product introduction based on features.
|
|
88
|
+
|
|
89
|
+
**Parameters:**
|
|
90
|
+
- `productName` (string, required): The name of the product
|
|
91
|
+
- `features` (array, required): List of product features and benefits
|
|
92
|
+
- `language` (string, optional): Output language (default: 'English')
|
|
93
|
+
- `voiceTone` (string, optional): Tone of voice (e.g., 'Professional', 'Casual', 'Enthusiastic')
|
|
94
|
+
- `context` (string, optional): Additional context about target audience or use case
|
|
95
|
+
- `maxLength` (number, optional): Maximum length in words (default: 100)
|
|
96
|
+
|
|
97
|
+
**Returns:**
|
|
98
|
+
- Promise<string>: Status URL for polling the job result
|
|
99
|
+
|
|
100
|
+
**Example:**
|
|
101
|
+
```javascript
|
|
102
|
+
const statusUrl = await service.generateProductIntro(
|
|
103
|
+
'Smart Fitness Watch',
|
|
104
|
+
['Heart rate monitoring', 'GPS tracking', '7-day battery'],
|
|
105
|
+
'English',
|
|
106
|
+
'Enthusiastic',
|
|
107
|
+
'Target audience: fitness enthusiasts aged 25-40'
|
|
108
|
+
);
|
|
109
|
+
const result = await service.fetchResults(statusUrl);
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Response Format
|
|
113
|
+
|
|
114
|
+
The API returns a professionally crafted product introduction:
|
|
115
|
+
|
|
116
|
+
```json
|
|
117
|
+
{
|
|
118
|
+
"product_intro": "Elevate your game with our Wireless RGB Gaming Mouse. Featuring a precision 16000 DPI optical sensor and customizable RGB lighting, this ergonomic powerhouse puts victory at your fingertips. With 8 programmable buttons, customize your gameplay and dominate the competition.",
|
|
119
|
+
"word_count": 42,
|
|
120
|
+
"tone": "Enthusiastic"
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## Examples
|
|
127
|
+
|
|
128
|
+
### Basic Product Intro
|
|
129
|
+
|
|
130
|
+
```javascript
|
|
131
|
+
const { SharpApiProductIntroService } = require('@sharpapi/sharpapi-node-product-intro');
|
|
132
|
+
|
|
133
|
+
const service = new SharpApiProductIntroService(process.env.SHARP_API_KEY);
|
|
134
|
+
|
|
135
|
+
const product = 'Premium Noise-Canceling Headphones';
|
|
136
|
+
const features = [
|
|
137
|
+
'Active noise cancellation',
|
|
138
|
+
'40-hour battery life',
|
|
139
|
+
'Bluetooth 5.0',
|
|
140
|
+
'Comfortable over-ear design'
|
|
141
|
+
];
|
|
142
|
+
|
|
143
|
+
service.generateProductIntro(product, features)
|
|
144
|
+
.then(statusUrl => service.fetchResults(statusUrl))
|
|
145
|
+
.then(result => {
|
|
146
|
+
const intro = result.getResultJson();
|
|
147
|
+
console.log('📝 Product Introduction:');
|
|
148
|
+
console.log(intro.product_intro);
|
|
149
|
+
})
|
|
150
|
+
.catch(error => console.error('Generation failed:', error));
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Tone-Specific Intro
|
|
154
|
+
|
|
155
|
+
```javascript
|
|
156
|
+
const service = new SharpApiProductIntroService(process.env.SHARP_API_KEY);
|
|
157
|
+
|
|
158
|
+
const productName = 'Professional Chef Knife Set';
|
|
159
|
+
const features = [
|
|
160
|
+
'High-carbon stainless steel',
|
|
161
|
+
'Ergonomic handles',
|
|
162
|
+
'Full-tang construction',
|
|
163
|
+
'Includes 8 essential knives'
|
|
164
|
+
];
|
|
165
|
+
|
|
166
|
+
const statusUrl = await service.generateProductIntro(
|
|
167
|
+
productName,
|
|
168
|
+
features,
|
|
169
|
+
'English',
|
|
170
|
+
'Professional',
|
|
171
|
+
'Target audience: professional chefs and culinary students',
|
|
172
|
+
80
|
|
173
|
+
);
|
|
174
|
+
|
|
175
|
+
const result = await service.fetchResults(statusUrl);
|
|
176
|
+
console.log('Professional intro:', result.getResultJson().product_intro);
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### Batch Product Intro Generation
|
|
180
|
+
|
|
181
|
+
```javascript
|
|
182
|
+
const service = new SharpApiProductIntroService(process.env.SHARP_API_KEY);
|
|
183
|
+
|
|
184
|
+
const products = [
|
|
185
|
+
{
|
|
186
|
+
name: 'Smart Water Bottle',
|
|
187
|
+
features: ['Hydration tracking', 'Temperature sensor', 'LED reminders']
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
name: 'Yoga Mat Pro',
|
|
191
|
+
features: ['Extra thick cushioning', 'Non-slip surface', 'Eco-friendly']
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
name: 'Portable Blender',
|
|
195
|
+
features: ['USB rechargeable', 'BPA-free', 'One-touch operation']
|
|
196
|
+
}
|
|
197
|
+
];
|
|
198
|
+
|
|
199
|
+
const intros = await Promise.all(
|
|
200
|
+
products.map(async (product) => {
|
|
201
|
+
const statusUrl = await service.generateProductIntro(
|
|
202
|
+
product.name,
|
|
203
|
+
product.features,
|
|
204
|
+
'English',
|
|
205
|
+
'Enthusiastic'
|
|
206
|
+
);
|
|
207
|
+
const result = await service.fetchResults(statusUrl);
|
|
208
|
+
return {
|
|
209
|
+
product: product.name,
|
|
210
|
+
intro: result.getResultJson().product_intro
|
|
211
|
+
};
|
|
212
|
+
})
|
|
213
|
+
);
|
|
214
|
+
|
|
215
|
+
intros.forEach(item => {
|
|
216
|
+
console.log(`\n${item.product}:`);
|
|
217
|
+
console.log(item.intro);
|
|
218
|
+
});
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
## Use Cases
|
|
224
|
+
|
|
225
|
+
- **E-commerce Product Pages**: Create compelling product descriptions
|
|
226
|
+
- **Marketing Campaigns**: Generate attention-grabbing product pitches
|
|
227
|
+
- **Email Marketing**: Craft product introductions for newsletters
|
|
228
|
+
- **Social Media**: Create engaging product posts
|
|
229
|
+
- **Catalog Creation**: Auto-generate introductions for large product catalogs
|
|
230
|
+
- **A/B Testing**: Generate multiple versions for conversion testing
|
|
231
|
+
- **Marketplace Listings**: Optimize product listings on marketplaces
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
## Voice Tones
|
|
236
|
+
|
|
237
|
+
Choose from various voice tones to match your brand:
|
|
238
|
+
|
|
239
|
+
- **Professional**: Formal, authoritative, business-focused
|
|
240
|
+
- **Casual**: Friendly, conversational, approachable
|
|
241
|
+
- **Enthusiastic**: Energetic, exciting, motivational
|
|
242
|
+
- **Luxury**: Sophisticated, premium, exclusive
|
|
243
|
+
- **Technical**: Detailed, specification-focused, precise
|
|
244
|
+
- **Humorous**: Lighthearted, fun, entertaining
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
## API Endpoint
|
|
249
|
+
|
|
250
|
+
**POST** `/ecommerce/product_intro`
|
|
251
|
+
|
|
252
|
+
For detailed API specifications, refer to:
|
|
253
|
+
- [Postman Documentation](https://documenter.getpostman.com/view/31106842/2sBXVeGsa7)
|
|
254
|
+
- [Product Page](https://sharpapi.com/en/catalog/ai/e-commerce/product-intro-generator)
|
|
255
|
+
|
|
256
|
+
---
|
|
257
|
+
|
|
258
|
+
## Related Packages
|
|
259
|
+
|
|
260
|
+
- [@sharpapi/sharpapi-node-product-description](https://www.npmjs.com/package/@sharpapi/sharpapi-node-product-description) - Full product descriptions
|
|
261
|
+
- [@sharpapi/sharpapi-node-product-categories](https://www.npmjs.com/package/@sharpapi/sharpapi-node-product-categories) - Product categorization
|
|
262
|
+
- [@sharpapi/sharpapi-node-seo-tags](https://www.npmjs.com/package/@sharpapi/sharpapi-node-seo-tags) - SEO optimization
|
|
263
|
+
- [@sharpapi/sharpapi-node-client](https://www.npmjs.com/package/@sharpapi/sharpapi-node-client) - Full SharpAPI SDK
|
|
264
|
+
|
|
265
|
+
---
|
|
266
|
+
|
|
267
|
+
## License
|
|
268
|
+
|
|
269
|
+
This project is licensed under the MIT License. See the [LICENSE.md](LICENSE.md) file for details.
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
273
|
+
## Support
|
|
274
|
+
|
|
275
|
+
- **Documentation**: [SharpAPI.com Documentation](https://sharpapi.com/documentation)
|
|
276
|
+
- **Issues**: [GitHub Issues](https://github.com/sharpapi/sharpapi-node-client/issues)
|
|
277
|
+
- **Email**: contact@sharpapi.com
|
|
278
|
+
|
|
279
|
+
---
|
|
280
|
+
|
|
281
|
+
**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-intro",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "SharpAPI.com Node.js SDK for generating product introductions",
|
|
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 introduction",
|
|
23
|
+
"product description"
|
|
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-intro.git"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const { SharpApiCoreService, SharpApiJobTypeEnum } = require('@sharpapi/sharpapi-node-core');
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Service for generating product introductions using SharpAPI.com
|
|
5
|
+
*/
|
|
6
|
+
class SharpApiProductIntroService extends SharpApiCoreService {
|
|
7
|
+
/**
|
|
8
|
+
* Generates a shorter version of the product description.
|
|
9
|
+
* Provide as many details and parameters of the product to get the best marketing introduction possible.
|
|
10
|
+
* Comes in handy with populating product catalog data and bulk products processing.
|
|
11
|
+
*
|
|
12
|
+
* @param {string} productData
|
|
13
|
+
* @param {string|null} language
|
|
14
|
+
* @param {number|null} maxLength
|
|
15
|
+
* @param {string|null} voiceTone
|
|
16
|
+
* @returns {Promise<string>} - The status URL.
|
|
17
|
+
*/
|
|
18
|
+
async generateProductIntro(productData, language = null, maxLength = null, voiceTone = 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
|
+
|
|
24
|
+
const response = await this.makeRequest('POST', SharpApiJobTypeEnum.ECOMMERCE_PRODUCT_INTRO.url, data);
|
|
25
|
+
return this.parseStatusUrl(response);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
module.exports = { SharpApiProductIntroService };
|