A custom Optimizely Opal tool for generating compelling product descriptions based on product name, part number, and attributes.
- Multiple Description Types: Generate marketing, technical, or ecommerce descriptions
- Tone Customization: Choose between professional, casual, or enthusiastic tones
- Flexible Attributes: Support for product attributes with optional units
- Length Control: Configurable maximum description length
- Markdown Output: Optimized for Optimizely Opal display
optimizely-product-description-tool/
├── src/
│ ├── index.ts # Main Cloudflare Worker implementation
│ └── product-description.ts # Core description generation logic
├── package.json # Dependencies and scripts
├── tsconfig.json # TypeScript configuration
├── wrangler.toml # Cloudflare Worker config
└── README.md # This file
-
Install dependencies:
npm install
-
Build the project:
npm run build
-
Deploy to Cloudflare Workers:
npm run deploy
- URL:
GET /discovery - Description: Returns tool capabilities for Optimizely Opal integration
- URL:
GET /health - Description: Returns tool status and version information
- URL:
POST / - Description: Generates product descriptions based on input parameters
{
"productName": "Wireless Bluetooth Headphones",
"partNumber": "WH-1000XM4",
"attributes": [
{
"name": "Battery Life",
"value": "30",
"unit": "hours"
},
{
"name": "Weight",
"value": "254",
"unit": "grams"
},
{
"name": "Noise Cancellation",
"value": "Active"
}
]
}{
"productName": "Professional Camera Lens",
"partNumber": "EF-70-200mm-f2.8",
"attributes": [
{
"name": "Focal Length",
"value": "70-200mm"
},
{
"name": "Aperture",
"value": "f/2.8"
},
{
"name": "Filter Size",
"value": "77",
"unit": "mm"
}
],
"descriptionType": "technical",
"tone": "professional",
"maxLength": 300
}Focused on benefits and emotional appeal, perfect for promotional materials.
Detailed specifications and technical features, ideal for technical documentation.
Optimized for online product listings with emojis and call-to-action elements.
Formal language suitable for B2B and enterprise contexts.
Friendly, approachable language for consumer products.
Energetic and exciting language for promotional content.
- Deploy your tool to Cloudflare Workers
- Navigate to Optimizely Opal tools section:
https://opal.optimizely.com/tools - Add your discovery URL:
https://your-worker-domain.workers.dev/discovery - Test the integration in Optimizely Opal chat
npm run devnpm run deploy:stagingnpm run deployThe tool includes comprehensive error handling for:
- Missing required parameters
- Invalid parameter formats
- Network errors
- Generation failures
All errors are returned with appropriate HTTP status codes and detailed error messages.
Successful responses include:
- Generated description text
- Markdown-formatted output for Optimizely Opal
- Metadata (word count, character count, generation timestamp)
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
MIT License - see LICENSE file for details.
For issues and questions:
- Check the Optimizely Opal documentation
- Review the Cloudflare Workers documentation
- Open an issue in this repository
Built with ❤️ for Optimizely Opal