Overview
Enhance your Stardeck applications by integrating external APIs for weather data, maps, email notifications, SMS, and other services. This guide covers setting up API accounts, configuring credentials in Stardeck, and using the AI agent to build integrations.This guide uses a weather API as the main example, but the same principles apply to any external API integration.
Prerequisites
Before you begin, ensure you have:- An active Stardeck project
- Familiarity with environment variables in Stardeck
- An account with the API service you want to use
Popular API Services
Here are some commonly integrated APIs:- Payment Gateways: Stripe, Omise, PayPal - See detailed payment integration guide
- Weather: OpenWeatherMap, WeatherAPI, Tomorrow.io
- Maps & Location: Google Maps, Mapbox, OpenStreetMap
- Email: SendGrid, Mailgun, Resend
- SMS: Twilio, MessageBird, Vonage
- AI/ML: OpenAI, Anthropic, Google Gemini
- Social Media: Twitter API, Instagram API, LinkedIn API
For payment gateway integrations (Stripe, Omise), check out our comprehensive Payment Gateway Integration Guide which covers credit card processing, webhooks, and Thai QR payments.
Setting Up OpenWeatherMap (Example)
We’ll use OpenWeatherMap as an example for this guide.Creating an Account
- Go to openweathermap.org and click Sign In or Sign Up
- Complete the registration process
- Verify your email address
- You’ll be automatically enrolled in the Free tier
The free tier includes 1,000 API calls per day, which is perfect for development and small applications.
Getting Your API Key
- After signing in, go to your account page by clicking your username
- Navigate to the API keys tab
- You’ll see a default API key already created, or you can create a new one
- Copy your API key (starts with a long alphanumeric string)
Understanding API Limits
- Free tier: 1,000 calls/day, 60 calls/minute
- Data: Current weather, 5-day forecast, weather maps
- Updates: Weather data updates every 10 minutes
Setting Up Other Common APIs
Google Maps API
- Go to Google Cloud Console
- Create a new project or select existing
- Enable Maps JavaScript API and Geocoding API
- Go to Credentials and create an API key
- Restrict the key by HTTP referrer (for security)
SendGrid (Email)
- Sign up at sendgrid.com
- Verify your sender email address
- Go to Settings > API Keys
- Create an API key with appropriate permissions
- Copy the key (shown only once)
Twilio (SMS)
- Sign up at twilio.com
- Get your free trial phone number
- Find your Account SID and Auth Token in the dashboard
- Copy both credentials
Configuring Environment Variables in Stardeck
Add your API credentials to your Stardeck project as environment variables.Adding API Keys
- Open your project in the Stardeck dashboard
- Click the Settings button (gear icon)
- Navigate to the Environment Variables tab
OpenWeatherMap Configuration
API Key (Non-Secret)
- Key:
WEATHER_API_KEY - Value: Your OpenWeatherMap API key
- Secret Variable: Off (unchecked)
- Deployment Targets: Select Sandbox for testing
For public APIs like weather services, API keys can be non-secret if rate-limited per key. For production, consider marking as secret.
Google Maps Configuration
- Key:
GOOGLE_MAPS_API_KEY - Value: Your Google Maps API key
- Secret Variable: Off (for client-side use) or On (for server-side)
- Deployment Targets: Select Sandbox
SendGrid Configuration
- Key:
SENDGRID_API_KEY - Value: Your SendGrid API key (starts with
SG.) - Secret Variable: On (checked) - always keep email API keys secret
- Deployment Targets: Select Sandbox
Twilio Configuration
Add multiple variables for Twilio:-
Key:
TWILIO_ACCOUNT_SID - Value: Your Account SID
- Secret Variable: Off
-
Key:
TWILIO_AUTH_TOKEN - Value: Your Auth Token
- Secret Variable: On (checked)
-
Key:
TWILIO_PHONE_NUMBER - Value: Your Twilio phone number (e.g., +15551234567)
- Secret Variable: Off
Using the AI Agent to Build API Integrations
Now you can use Stardeck’s AI agent to build your API integration. Here are example prompts for common scenarios:Weather App with Current Conditions
Weather Dashboard with Forecast
Location-Based Services with Maps
Email Notifications
SMS Alerts
Multi-API Integration
Tips for Effective Prompting
- Name your environment variables clearly - The agent will use them automatically
- Specify data to display - Be clear about what information you want to show
- Mention error handling - APIs can fail, timeout, or return errors
- Request caching - Consider asking to cache API responses to save costs
- Be specific about frequency - How often should data refresh?
The AI agent understands popular API formats and will implement proper error handling, rate limiting, and best practices automatically.
Testing Your Integration
Testing Weather API
Test with various scenarios:- Valid city: Try “London” or “Bangkok”
- Invalid city: Try “XYZ123” to test error handling
- Special characters: Try “São Paulo” to test encoding
- Rate limits: Make multiple rapid requests to test rate limit handling
Testing Email/SMS APIs
For SendGrid and Twilio:- Use your personal email/phone during development
- Check spam folder for test emails
- Verify API call limits on dashboard
- Test with invalid recipients to check error handling
Monitoring API Usage
- Check your API provider’s dashboard regularly
- Monitor daily usage against limits
- Set up alerts for high usage
- Review error logs for failed requests
Best Practices
Security
- Mark sensitive keys as secret - Email, SMS, and payment APIs should always be secret
- Restrict API keys - Use HTTP referrer or IP restrictions when available
- Rotate keys regularly - Change API keys periodically
- Never commit keys to git - Always use environment variables
Performance
- Cache API responses - Don’t fetch the same data repeatedly
- Implement rate limiting - Respect API provider’s limits
- Use webhooks when available - More efficient than polling
- Handle errors gracefully - APIs can be temporarily unavailable
Cost Management
- Monitor usage - Check dashboards regularly
- Set spending limits - Use billing alerts
- Choose the right tier - Upgrade only when needed
- Optimize requests - Fetch only what you need
Going Live with Production
When you’re ready to go live:Moving to Production
- Upgrade API plan if needed - Check if free tier is sufficient
- Get production API keys - Many services have separate prod keys
- Add production environment variables in Stardeck
- Set Deployment Targets to Production
- Configure webhooks - Update webhook URLs to production domain
- Test thoroughly - Verify all API integrations work in production
Production Checklist
- Production API keys obtained
- Billing/payment method configured with API provider
- Usage alerts set up
- API keys configured in Stardeck production environment
- Error monitoring in place
- Rate limits appropriate for production traffic
- Webhook endpoints verified
- Documentation for team members
Additional Resources
Weather APIs
Maps & Location
Communication
AI & ML
Need help with API integration? Contact our support team through your dashboard or reach out to [email protected].