OpenAI Integration

What It Enables

Integrate AI capabilities into your workflows using OpenAI’s powerful models:

Prerequisites

How to Connect

Step 1: Get OpenAI API Key

  1. Go to platform.openai.com
  2. Sign in or create account
  3. Navigate to API Keys section
  4. Click “Create new secret key”
  5. Copy the key (starts with sk-)
  6. Important: Save it securely - you won’t see it again!

Step 2: Add OpenAI Action

  1. In your flow, click “+” to add a step
  2. Search for “OpenAI”
  3. Select the action you want (e.g., “Ask ChatGPT”)

Step 3: Connect with API Key

  1. Click “Connect” or “+ New Connection”
  2. Paste your OpenAI API key
  3. Click “Save”

Step 4: Configure Action

  1. Select model (GPT-4, GPT-3.5, etc.)
  2. Write your prompt
  3. Configure parameters (temperature, max tokens)
  4. Map data from previous steps

Step 5: Test

  1. Click “Test” to send request
  2. Review AI response
  3. Adjust prompt if needed

Available Actions

Ask ChatGPT

What: Send a prompt and get AI-generated response Use Cases:

Configuration:

Example Prompt:

Summarize the following customer feedback in 2-3 sentences:


Chat Completion

What: Multi-turn conversation with context Use Cases:

Configuration:

Example:

System: "You are a helpful customer service assistant."
User: ""

Text Completion (Legacy)

What: Complete text based on prompt Note: Deprecated, use Chat Completion instead

Generate Image (DALL-E)

What: Create images from text descriptions Use Cases:

Configuration:

Transcribe Audio (Whisper)

What: Convert audio to text Use Cases:

Configuration:

Moderate Content

What: Check content for policy violations Use Cases:

Returns: Flagged categories and scores

Model Selection

GPT-4 Turbo

GPT-4

GPT-3.5 Turbo

Choosing a Model

Prompt Engineering Tips

Be Specific

❌ “Write about customer service” ✅ “Write a 3-paragraph email responding to a customer complaint about late delivery”

Provide Context

You are a technical support specialist.
A customer reports: 
Write a helpful response that:
1. Acknowledges the issue
2. Provides troubleshooting steps
3. Offers escalation if needed

Use Examples

Extract the name and email from this text.

Example:
Input: "Contact John Doe at john@example.com"
Output: {"name": "John Doe", "email": "john@example.com"}

Now extract from:

Set Output Format

Analyze this feedback and respond in JSON format:
{
  "sentiment": "positive|negative|neutral",
  "category": "product|service|pricing",
  "priority": "high|medium|low",
  "summary": "brief summary"
}

Feedback: 

Control Creativity

Common Errors & Fixes

“Invalid API key”

Cause: API key incorrect or expired Fix:

  1. Verify API key is correct
  2. Check key hasn’t been revoked
  3. Generate new key if needed
  4. Update connection in Defense Catalyst

“Rate limit exceeded”

Cause: Too many requests per minute Fix:

  1. Reduce flow execution frequency
  2. Add delays between requests
  3. Upgrade OpenAI plan for higher limits
  4. Implement retry logic with backoff

“Insufficient quota”

Cause: No credits remaining in OpenAI account Fix:

  1. Check OpenAI billing dashboard
  2. Add credits to account
  3. Set up auto-recharge
  4. Monitor usage regularly

“Context length exceeded”

Cause: Prompt + response exceeds model limit Fix:

  1. Shorten your prompt
  2. Reduce max_tokens setting
  3. Use model with larger context (GPT-4 Turbo)
  4. Split into multiple requests

“Content policy violation”

Cause: Prompt or response violates OpenAI policies Fix:

  1. Review OpenAI usage policies
  2. Modify prompt to avoid sensitive topics
  3. Use content moderation action first
  4. Implement input filtering

“Model not found”

Cause: Model name incorrect or deprecated Fix:

  1. Check current model names in OpenAI docs
  2. Update to supported model
  3. Use gpt-3.5-turbo or gpt-4 as safe defaults

Test Checklist

Tips & Best Practices

Cost Management

Performance

Reliability

Security

Prompt Quality

Advanced Patterns

Structured Data Extraction

Extract information from this text and return as JSON:

Required fields:
- name (string)
- email (string)
- phone (string or null)
- company (string or null)

Text: 

Return only valid JSON, no explanation.

Multi-step Reasoning

  1. Step 1: Analyze input with GPT-4
  2. Step 2: Use analysis to generate response
  3. Step 3: Validate response with another call

Content Generation Pipeline

  1. Generate outline: Create structure
  2. Expand sections: Generate detailed content
  3. Review & edit: Polish with another prompt
  4. Format: Convert to desired format

Sentiment Analysis

Analyze the sentiment of this customer feedback.

Feedback: 

Respond with only one word: POSITIVE, NEGATIVE, or NEUTRAL

Translation Workflow

Translate the following text from  to .

Maintain the tone and style. If technical terms exist, keep them in original language.

Text: 

Token Usage & Costs

Understanding Tokens

Estimating Costs

Cost Optimization

Limitations

Rate Limits (varies by plan)

Context Limits

Response Time

Example Use Cases

Customer Support Automation

Webhook → OpenAI (analyze issue) → Route to appropriate team

Content Generation

Schedule → OpenAI (generate post) → Post to social media

Data Enrichment

New record → OpenAI (extract/categorize) → Update database

Email Response

Email received → OpenAI (draft response) → Send for approval

Document Summarization

File uploaded → OpenAI (summarize) → Send summary via Slack

Need Help?