OpenAI कनेक्टर

अपने marketing automation workflows के लिए AI-powered content generation, customer sentiment analysis, intelligent segmentation, और predictive analytics का लाभ उठाने हेतु Tajo के माध्यम से OpenAI को Brevo से कनेक्ट करें।

अवलोकन

PropertyValue
PlatformOpenAI
CategoryAI / ML (Custom)
Setup ComplexityMedium
Official IntegrationNo
Data SyncedContent, Embeddings, Insights, Predictions
Auth MethodAPI Key (Bearer Token)

विशेषताएं

  • AI content generation - GPT models के साथ email subject lines, body copy, और CTAs generate करें
  • Customer sentiment analysis - sentiment scoring के लिए support tickets और feedback का विश्लेषण करें
  • Smart segmentation - behavior patterns द्वारा customers को cluster करने के लिए embeddings का उपयोग करें
  • Predictive analytics - churn, LTV, और purchase propensity का पूर्वानुमान लगाएं
  • Multi-language content - किसी भी supported language में marketing content generate करें
  • Image generation - DALL-E integration के साथ campaign visuals बनाएं

पूर्वावश्यकताएं

शुरू करने से पहले, सुनिश्चित करें कि आपके पास हैं:

  1. API access वाला एक OpenAI account
  2. OpenAI dashboard से एक API key
  3. API access वाला एक Brevo account
  4. connector permissions वाला एक Tajo account
  5. अपने अपेक्षित उपयोग के लिए पर्याप्त OpenAI API credits

प्रमाणीकरण

API Key Authentication

OpenAI सभी API requests के लिए Bearer token authentication का उपयोग करता है:

Terminal window
# अपनी API keys सेट करें
export OPENAI_API_KEY=sk-your-api-key
export TAJO_API_KEY=your_tajo_api_key
export BREVO_API_KEY=your_brevo_api_key
// सभी requests के लिए Authorization header आवश्यक है
const headers = {
'Authorization': `Bearer ${process.env.OPENAI_API_KEY}`,
'Content-Type': 'application/json'
};
// organization-scoped access के लिए
const orgHeaders = {
...headers,
'OpenAI-Organization': process.env.OPENAI_ORG_ID,
'OpenAI-Project': process.env.OPENAI_PROJECT_ID
};

API Key Security

अपनी OpenAI API key को कभी भी client-side code में expose न करें। हमेशा environment variables और server-side requests का उपयोग करें। OpenAI dashboard के माध्यम से keys को समय-समय पर rotate करें।

कॉन्फ़िगरेशन

बेसिक सेटअप

connectors:
openai:
enabled: true
model: "gpt-4o"
embedding_model: "text-embedding-3-small"
image_model: "dall-e-3"
features:
content_generation: true
sentiment_analysis: true
smart_segmentation: true
predictive_analytics: true
limits:
max_tokens_per_request: 4096
max_requests_per_minute: 60
temperature: 0.7

Content Generation Templates

templates:
email_subject:
model: "gpt-4o"
system_prompt: |
आप एक expert email marketer हैं। ऐसी compelling
subject lines generate करें जो open rates बढ़ाएं।
max_tokens: 100
temperature: 0.8
email_body:
model: "gpt-4o"
system_prompt: |
customer data और campaign objectives के आधार पर
personalized email content generate करें।
max_tokens: 2048
temperature: 0.7

API Endpoints

EndpointMethodविवरण
https://api.openai.com/v1/responsesPOSTAI responses बनाएं (Responses API)
https://api.openai.com/v1/chat/completionsPOSTtext completions generate करें
https://api.openai.com/v1/embeddingsPOSTtext embeddings बनाएं
https://api.openai.com/v1/images/generationsPOSTimages generate करें
https://api.openai.com/v1/audio/speechPOSTText-to-speech generation
https://api.openai.com/v1/audio/transcriptionsPOSTSpeech-to-text transcription
https://api.openai.com/v1/moderationsPOSTContent moderation
https://api.openai.com/v1/modelsGETउपलब्ध models list करें

कोड उदाहरण

कनेक्टर शुरू करें

import { TajoClient } from '@tajo/sdk';
const tajo = new TajoClient({
apiKey: process.env.TAJO_API_KEY,
brevoApiKey: process.env.BREVO_API_KEY
});
await tajo.connectors.connect('openai', {
apiKey: process.env.OPENAI_API_KEY,
defaultModel: 'gpt-4o'
});

Email Content Generate करें

// personalized email subject lines generate करें
const response = await fetch('https://api.openai.com/v1/chat/completions', {
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.OPENAI_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'gpt-4o',
messages: [
{
role: 'system',
content: 'Generate 5 compelling email subject lines for a product launch.'
},
{
role: 'user',
content: `Product: ${product.name}. Target: ${segment.description}.`
}
],
max_tokens: 200,
temperature: 0.8
})
});
const result = await response.json();
const subjectLines = result.choices[0].message.content;

Customer Sentiment Analysis

// customer feedback sentiment का विश्लेषण करें
const sentimentAnalysis = await fetch(
'https://api.openai.com/v1/chat/completions',
{
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.OPENAI_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'gpt-4o',
messages: [
{
role: 'system',
content: 'Analyze sentiment. Return JSON: {score: -1 to 1, label: string, topics: string[]}'
},
{ role: 'user', content: customerFeedback }
],
response_format: { type: 'json_object' },
max_tokens: 150
})
}
);
const sentiment = await sentimentAnalysis.json();
await tajo.contacts.update(email, {
attributes: { SENTIMENT_SCORE: JSON.parse(sentiment.choices[0].message.content).score }
});

Embeddings के साथ Smart Segmentation

// customer clustering के लिए embeddings generate करें
const embeddingResponse = await fetch(
'https://api.openai.com/v1/embeddings',
{
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.OPENAI_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'text-embedding-3-small',
input: customerDescriptions,
dimensions: 256
})
}
);
const embeddings = await embeddingResponse.json();
// similarity-आधारित customer clustering के लिए embeddings का उपयोग करें

Rate Limits

ModelRPM (Requests/Min)TPM (Tokens/Min)RPD (Requests/Day)
gpt-4o50030,00010,000
gpt-4o-mini500200,00010,000
text-embedding-3-small5001,000,00010,000
dall-e-35N/A200

Rate Limit Headers

API responses में rate limit headers (x-ratelimit-remaining-requests, x-ratelimit-remaining-tokens) को monitor करें ताकि सक्रिय throttling लागू कर सकें और 429 errors से बच सकें।

समस्या निवारण

समस्याकारणसमाधान
401 Unauthorizedअमान्य API keyOpenAI dashboard में key सत्यापित करें
429 Rate Limitedबहुत अधिक requestsexponential backoff लागू करें
500 Server ErrorOpenAI outagestatus.openai.com जांचें और retry करें
Truncated responsemax_tokens बहुत कमmax_tokens parameter बढ़ाएं
खराब content qualityTemperature बहुत अधिकconsistency के लिए temperature कम करें

Debug Mode

connectors:
openai:
debug: true
log_level: verbose
log_prompts: false # production में prompts log न करें
log_usage: true

सर्वोत्तम प्रथाएं

  1. Responses cache करें - API calls और costs कम करने के लिए generated content store करें
  2. Structured outputs का उपयोग करें - विश्वसनीय parsing के लिए JSON responses का अनुरोध करें
  3. Retry logic लागू करें - exponential backoff के साथ rate limits संभालें
  4. Token usage monitor करें - costs नियंत्रित करने के लिए consumption ट्रैक करें
  5. उपयुक्त models का उपयोग करें - सरल कार्यों के लिए gpt-4o-mini, जटिल कार्यों के लिए gpt-4o का उपयोग करें
  6. Outputs validate करें - customers को भेजने से पहले हमेशा AI-generated content validate करें

सुरक्षा

  • Bearer token auth - API keys Authorization header के माध्यम से transmit होती हैं
  • Server-side only - API keys को कभी भी client-side code में expose न करें
  • Key rotation - OpenAI dashboard के माध्यम से API keys को नियमित रूप से rotate करें
  • Usage monitoring - OpenAI billing settings में spending limits सेट करें
  • Content moderation - unsafe content filter करने के लिए Moderations API का उपयोग करें
  • Data privacy - अपने use case के लिए OpenAI की data usage policies की समीक्षा करें

संबंधित संसाधन

Subscribe to updates

developer-docs

Drop your email or phone number — we'll send you what matters next.

auto-detect
AI Assistant

Hi! Ask me anything about the docs.