Skip to main content

Writing Effective Descriptions

The description is the most critical part of your function definition.

Be Specific

❌ Bad:
✅ Good:

Include Trigger Examples

Specify When NOT to Call


Parameter Design

Use Enums for Constrained Values

❌ Bad:
✅ Good:

Provide Clear Descriptions

Set Validation Rules


Security

Never Hardcode Secrets

❌ Bad:
✅ Good:

Use Environment Variables

Store sensitive data in environment variables:
  • {{API_KEY}}
  • {{DATABASE_URL}}
  • {{WEBHOOK_SECRET}}

Validate Inputs

Add validation in your API:

Implement Rate Limiting


Error Handling

Return Clear Error Messages

Handle Timeouts

Set reasonable timeouts:

Provide Fallbacks


Performance

Keep Responses Fast

  • Optimize API response time (< 2 seconds)
  • Use caching where appropriate
  • Return only necessary data

Minimize Function Calls

  • Batch operations when possible
  • Cache frequently accessed data
  • Avoid redundant calls

Use Async Processing

For long-running operations:

Testing

Test with Sample Data

Use Staging Endpoints

Log Everything


Documentation

Document Your Functions

Create internal documentation:

Version Your APIs

Use versioned endpoints:

Next Steps

Testing Functions

Learn how to test and debug functions

API Integration

Complete API integration guide