Guide

API Playground (https://app.contacted.io/console/playground)

The API Playground allows you to test and preview your email generation before implementing it in your application. This interactive tool helps you perfect your prompts and see exactly how your emails will appear to recipients.

How to Use the Playground

1. Describe Your Email

In the Prompt section, provide a detailed description of your transactional email. Be specific about:

  • The email's purpose (welcome, password reset, order confirmation, etc.)

  • Key content that should be included

  • How your data should be used (e.g., "Welcome email that includes the user's name and membership tier with their benefits listed")

  • Any image requirements and positioning

  • Specific formatting or layout preferences

Tip: More detailed descriptions help our AI create better results. While brief descriptions like "password reset email" work, providing context improves accuracy.

2. Add Dynamic Data

Use the Data Key-Value Pairs section to provide sample data that will be inserted into your email:

  • Click "+ Add Data Field" to create new key-value pairs

  • Use realistic sample data that represents what you'll send in production

  • Common examples: name: "John Smith", order_number: "12345", membership_tier: "Premium"

Note: Don't worry about data types - the system handles formatting automatically.

3. Preview Your Email

Click "Generate Email" to see a live preview of how your email will appear. The preview shows your email with your branding applied and sample data populated.

Important: This preview counts as 1 sent email against your plan limits.

4. Copy Implementation Code

Once you're satisfied with the preview, copy the SDK code from the right panel. Choose from:

  • Node.js - For JavaScript/TypeScript applications

  • Python - For Python applications

  • cURL - For testing or other languages

5. Implement in Your Application

Before using the copied code in production:

  • Replace "<key>" with your actual API key

  • Replace "<email subject line>" with your desired subject

  • Replace "<sender address>" with your verified sender email

  • Replace "<receiver address>" with the recipient's email

  • Update the prompt field if needed for your use case

Best Practices

  • Test different prompt variations to find what works best for your use case

  • Use realistic sample data that matches your production data structure

  • Check the email preview on both desktop and mobile views

  • Verify all placeholder values are replaced before deploying to production

Next Steps

Once you've perfected your email in the playground, check our API documentation for complete implementation examples and best practices for production use.

Last updated