# Integration Examples Common custom action patterns and real-world integration examples Custom actions require a Pro plan or higher. Upgrade to Pro → ## Slack Notifications Send messages to Slack channels via webhook. ### Configuration ```bash curl -X POST https://hooks.slack.com/services/{{var.SLACK_WEBHOOK_ID}} \ -H "Content-Type: application/json" \ -d '{ "text": "{{message}}", "channel": "{{channel}}", "username": "Chipp Bot" }' ``` ### Parameters | Parameter | Source | Configuration | | ------------------ | ------------ | ------------------------- | | `message` | AI Generated | Message content to send | | `channel` | AI Generated | Target channel (optional) | | `SLACK_WEBHOOK_ID` | Variable | Your Slack webhook ID | ### Usage _"Send a message to #general saying the report is ready"_ ## OpenAI Completions Call OpenAI's API for advanced processing. ### Configuration ```bash curl -X POST https://api.openai.com/v1/chat/completions \ -H "Authorization: Bearer {{var.OPENAI_API_KEY}}" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-4", "messages": {{system.message_history}}, "temperature": 0.7, "max_tokens": {{maxTokens}} }' ``` ### Parameters | Parameter | Source | Configuration | | ----------------- | ----------------- | --------------------------- | | `OPENAI_API_KEY` | Variable (secret) | Your OpenAI API key | | `message_history` | System Variable | Conversation context | | `maxTokens` | AI Generated | Token limit (default: 1000) | ## SendGrid Email Send transactional emails via SendGrid. ### Configuration ```bash curl -X POST https://api.sendgrid.com/v3/mail/send \ -H "Authorization: Bearer {{var.SENDGRID_API_KEY}}" \ -H "Content-Type: application/json" \ -d '{ "personalizations": [{ "to": [{"email": "{{recipientEmail}}"}], "subject": "{{subject}}" }], "from": { "email": "{{var.FROM_EMAIL}}", "name": "{{var.FROM_NAME}}" }, "content": [{ "type": "text/html", "value": "{{emailBody}}" }] }' ``` ### Variables ```bash SENDGRID_API_KEY = SG.abc123... FROM_EMAIL = noreply@example.com FROM_NAME = Your Company ``` ## Google Sheets Read and write data to Google Sheets. ### Read Data ```bash curl -X GET "https://sheets.googleapis.com/v4/spreadsheets/{{var.SHEET_ID}}/values/{{range}}" \ -H "Authorization: Bearer {{var.GOOGLE_API_KEY}}" ``` ### Append Data ```bash curl -X POST "https://sheets.googleapis.com/v4/spreadsheets/{{var.SHEET_ID}}/values/{{range}}:append" \ -H "Authorization: Bearer {{var.GOOGLE_API_KEY}}" \ -H "Content-Type: application/json" \ -d '{ "values": [[ "{{system.timestamp}}", "{{system.user_id}}", "{{data}}" ]] }' ``` ## Webhook with Dependencies Multi-step workflow using action dependencies. ### Step 1: Create User ```bash curl -X POST https://api.example.com/users \ -H "Content-Type: application/json" \ -H "Authorization: Bearer {{var.API_KEY}}" \ -d '{ "name": "{{userName}}", "email": "{{userEmail}}" }' ``` Returns: `{"data": {"id": "user_123", "email": "john@example.com"}}` ### Step 2: Send Welcome Email Use the user ID from Step 1: ```bash curl -X POST https://api.example.com/emails \ -H "Content-Type: application/json" \ -H "Authorization: Bearer {{var.API_KEY}}" \ -d '{ "user_id": "{{userId}}", "template": "welcome", "send_at": "{{system.timestamp}}" }' ``` **Parameter Configuration for `user_id`:** - Source: Output from another Action - Action: Create User - JSONPath: `$.data.id` ## CRM Integration Update customer records in your CRM. ### Configuration ```bash curl -X PATCH https://api.crm.com/v2/contacts/{{contactId}} \ -H "Authorization: Bearer {{var.CRM_API_KEY}}" \ -H "Content-Type: application/json" \ -d '{ "properties": { "last_contact": "{{system.timestamp}}", "last_message": "{{summary}}", "status": "{{status}}" } }' ``` ### AI Instructions For `summary` parameter: ``` Summarize the key points from the conversation in 1-2 sentences ``` For `status` parameter: ``` Determine status: 'interested', 'qualified', 'not-interested', or 'follow-up' ``` ## Stripe Payment Create payment intents via Stripe API. ### Configuration ```bash curl -X POST https://api.stripe.com/v1/payment_intents \ -u "{{var.STRIPE_SECRET_KEY}}:" \ -H "Content-Type: application/x-www-form-urlencoded" \ -d "amount={{amount}}¤cy=usd&customer={{customerId}}" ``` ### Parameters | Parameter | Source | Configuration | | ------------------- | ----------------- | ---------------------- | | `STRIPE_SECRET_KEY` | Variable (secret) | Your Stripe secret key | | `amount` | AI Generated | Amount in cents | | `customerId` | AI Generated | Stripe customer ID | ## Weather API Fetch weather data for user queries. ### Configuration ```bash curl -X GET "https://api.openweathermap.org/data/2.5/weather" \ -G \ --data-urlencode "q={{city}}" \ --data-urlencode "appid={{var.WEATHER_API_KEY}}" \ --data-urlencode "units=metric" ``` ### Usage Examples _"What's the weather in New York?"_ _"Is it raining in London?"_ ## GitHub Integration Create issues in GitHub repositories. ### Configuration ```bash curl -X POST https://api.github.com/repos/{{var.GITHUB_OWNER}}/{{var.GITHUB_REPO}}/issues \ -H "Authorization: Bearer {{var.GITHUB_TOKEN}}" \ -H "Content-Type: application/json" \ -d '{ "title": "{{issueTitle}}", "body": "{{issueBody}}", "labels": {{labels}}, "assignees": {{assignees}} }' ``` ### Parameter Configuration | Parameter | Source | AI Instructions | |-----------|--------|-----------------| | `issueTitle` | AI Generated | Create a concise title for the GitHub issue | | `issueBody` | AI Generated | Write a detailed description of the issue | | `labels` | AI Generated | Array of relevant labels like ["bug", "urgent"] | | `assignees` | AI Generated | Array of GitHub usernames to assign | ## Best Practices ### 1. Error Handling Always return clear error messages: ```json { "success": false, "error": "API key invalid. Please check your credentials." } ``` ### 2. Rate Limiting Respect API rate limits: - Add delays between requests - Implement exponential backoff - Cache responses when possible ### 3. Security - Use HTTPS endpoints only - Store credentials as secret variables - Never log sensitive data - Validate all inputs ### 4. Performance - Paginate large result sets - Use field selection to minimize data - Implement timeouts (30s max) - Cache frequently accessed data ### 5. Testing - Test with various inputs - Verify error handling - Check edge cases - Monitor response times ## Next Steps - [Getting Started →](/docs/custom-actions/getting-started) - [Parameter Configuration →](/docs/custom-actions/parameters) - [Manage Variables →](/docs/custom-actions/variables) - [Testing Guide →](/docs/custom-actions/testing)