> ## Documentation Index
> Fetch the complete documentation index at: https://docs.greenflash.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Workflow Integrations

> Trigger n8n, Zapier, Slack, and other workflows with Greenflash webhooks.

Greenflash webhooks seamlessly integrate with your existing workflow automation tools like n8n, Zapier, and Slack, enabling you to build powerful, automated responses to conversation events in real time. Transform both opportunities and issues into immediate action without writing custom integration code.

## Why workflow automation matters

Your users and AI products generate some of your most important business signals. Some indicate problems to fix, others reveal opportunities to capture. Workflow automation ensures you:

* **Capture opportunities** when users are highly engaged or ready to convert
* **Respond instantly** to quality issues before users churn
* **Route hot leads** to your sales team at the perfect moment
* **Scale actions** across thousands of conversations simultaneously
* **Connect Greenflash signals** to your entire tech stack (Slack, HubSpot, Salesforce, Zendesk, etc.)
* **Build complex logic** with visual workflow builders or direct integrations
* **Iterate quickly** on response strategies without deployment cycles

## How it works

Greenflash webhooks push real-time events to your workflow automation platform whenever meaningful thresholds are crossed, whether that's a quality drop that needs attention or a positive signal that represents opportunity. Your workflows then:

1. **Receive** the webhook payload containing message, conversation, or product metrics and other relevant data
2. **Process** the data through conditional logic and transformations
3. **Trigger** actions across your connected apps and services

This event-driven architecture ensures you're always responding to the latest signals in real time, not stale data from periodic checks.

## Zapier integration

### Getting started with Zapier

Zapier's no-code platform makes it simple to connect Greenflash quality events to over 5,000+ apps. Set up your first automation in minutes:

1. **Create a webhook trigger** in Zapier using "Webhooks by Zapier"
2. **Copy the webhook URL** Zapier provides
3. **Add the URL** to your Greenflash webhook settings
4. **Validate the webhook** using the example validation code in the Greenflash webhook settings
5. **Select events** you want to trigger the workflow
6. **Build your actions** using Zapier's visual builder

### Example: Low sentiment email alerts

We've created a ready-to-use Zapier template that monitors conversation sentiment and sends email alerts when quality drops:

[**Get email notifications for low sentiment conversations →**](https://zapier.com/shared/eedd8945ef33e1c71f5c98e691e09a69669c4c45)

This template demonstrates:

* Webhook payload parsing and validation
* Sentiment threshold filtering
* Dynamic email content based on conversation data
* Data persistence between webhook calls

### Common Zapier use cases

**Problem Detection:**

* **Slack alerts** when Product Quality Index (PQI) drops below 60
* **Create Jira tickets** for conversations with negative ratings
* **Trigger SMS alerts** via Twilio for critical quality drops
* **Post to Microsoft Teams** channels for urgent issues

**Opportunity Capture:**

* **Push highly engaged users** to HubSpot or Salesforce for sales outreach
* **Tag power users** in your CRM when sentiment exceeds 80%
* **Add satisfied customers** to upsell campaigns in Mailchimp
* **Create opportunities** in Pipedrive when users show buying signals
* **Celebrate milestones** with automated rewards via Tremendous
* **Log events** to Google Sheets for commission tracking

## n8n integration

### Getting started with n8n

n8n's self-hosted, source-available platform gives you complete control over your automation workflows with advanced features like:

* JavaScript code nodes for complex transformations
* Conditional branching and error handling
* Sub-workflows for modular automation
* Built-in data storage and queuing

To connect Greenflash to n8n:

1. **Add a Webhook node** to your n8n workflow
2. **Configure the webhook** with method POST and response mode "On Received"
3. **Copy the production URL** from the webhook node
4. **Add this URL** to your Greenflash webhook settings
5. **Validate the webhook** using the example validation code in the Greenflash webhook settings
6. **Select events** you want to trigger the workflow
7. **Build your actions** using n8n's visual builder

### Example: Quality alert with Zendesk ticketing

Here's a complete n8n workflow that triggers on low quality conversations, sends Slack alerts, and creates Zendesk tickets:

```json n8n-low-quality-interaction-alert.json theme={"theme":{"light":"github-light","dark":"vesper"}}
{
  "name": "Low Quality Interaction Alert",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "8cb66e40-9ad3-44da-9074-03e87c646335",
        "options": {}
      },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2.1,
      "position": [
        0,
        0
      ],
      "id": "64101053-727a-4424-8136-c26522e8fad2",
      "name": "Catch Greenflash webhook",
      "webhookId": "8cb66e40-9ad3-44da-9074-03e87c646335"
    },
    {
      "parameters": {
        "jsCode": "const crypto = require('crypto');\n\nfunction verifyWebhook(\n  body,         // Your parsed webhook payload\n  signature,    // X-Greenflash-Signature header\n  timestamp,    // X-Greenflash-Timestamp header\n  deliveryId,   // X-Greenflash-Delivery header\n  secret        // Your webhook signing secret\n) {\n  // Convert body to canonical JSON string (no whitespace)\n  const bodyString = JSON.stringify(body);\n\n  // Hash the body\n  const bodyHash = crypto\n    .createHmac('sha256', secret)\n    .update(bodyString)\n    .digest('hex');\n\n  // Reconstruct the signed string\n  const canonical = `${timestamp}.${deliveryId}.${bodyHash}`;\n\n  // Compute expected signature\n  const digest = crypto\n    .createHmac('sha256', secret)\n    .update(canonical)\n    .digest('hex');\n\n  const expected = `v1=${digest}`;\n\n  // Compare securely (prevents timing attacks)\n  return crypto.timingSafeEqual(\n    Buffer.from(signature),\n    Buffer.from(expected)\n  );\n}\n\nconst webhookJson = $('Catch Greenflash webhook').first().json;\nconst body = webhookJson.body;\nconst signature = webhookJson.headers['x-greenflash-signature'];\nconst timestamp = webhookJson.headers['x-greenflash-timestamp'];\nconst deliveryId = webhookJson.headers['x-greenflash-delivery'];\nconst secret = $vars.GREENFLASH_WEBHOOK_SECRET;\n\nconst verified = verifyWebhook(body, signature, timestamp, deliveryId, secret);\n\nreturn [{ verified }]"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        208,
        0
      ],
      "id": "4d3ca000-ae33-42dd-83ce-9554ef20b485",
      "name": "Verify webhook signature"
    },
    {
      "parameters": {
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "text": "=❗️ Low quality interaction occuring.\n\nUser: User 123\n\nConversation ID: {{ $('Catch Greenflash webhook').item.json.body.metadata.conversationId }}\n\nQuality index score: {{ $('Catch Greenflash webhook').item.json.body.payload.conversation.qualityIndex.current }}",
        "otherOptions": {}
      },
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2.3,
      "position": [
        416,
        0
      ],
      "id": "55e6e368-a5a2-4e98-bd6e-867e9d9e7c70",
      "name": "Send an alert to Slack",
      "webhookId": "051f6eef-85d1-4865-b7fe-3f245f89a664"
    },
    {
      "parameters": {
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.zendesk",
      "typeVersion": 1,
      "position": [
        416,
        224
      ],
      "id": "2a2008fe-433f-4e4a-83c9-2bac3e2a915c",
      "name": "Create a ticket"
    }
  ],
  "pinData": {
    "Catch Greenflash webhook": [
      {
        "json": {
          "headers": {
            "host": "greenflash.app.n8n.cloud",
            "user-agent": "Greenflash-Webhook/1.0",
            "content-length": "360",
            "accept": "*/*",
            "accept-encoding": "gzip, br",
            "accept-language": "*",
            "baggage": "sentry-environment=vercel-production,sentry-release=25a6d226beb1408a276c74b8c623bd8c9190a912,sentry-public_key=c8d2e8c17bf3648731c05d128a2abe78,sentry-trace_id=53380d076c7442d8a171b53c823b869e,sentry-org_id=4509720677842944,sentry-transaction=GET%20%2Fapp%2Fsettings%2Fwebhooks,sentry-sampled=true,sentry-sample_rand=0.9265695579698254,sentry-sample_rate=1",
            "cdn-loop": "cloudflare; loops=1; subreqs=1",
            "cf-connecting-ip": "54.67.33.246",
            "cf-ew-via": "15",
            "cf-ipcountry": "US",
            "cf-ray": "98b0216ad0899810-LAX",
            "cf-visitor": "{\"scheme\":\"https\"}",
            "cf-worker": "n8n.cloud",
            "content-type": "application/json",
            "sec-fetch-mode": "cors",
            "sentry-trace": "53380d076c7442d8a171b53c823b869e-eed929b3ad4653d4-1",
            "x-forwarded-for": "54.67.33.246, 104.23.251.207",
            "x-forwarded-host": "greenflash.app.n8n.cloud",
            "x-forwarded-port": "443",
            "x-forwarded-proto": "https",
            "x-forwarded-server": "traefik-prod-users-gwc-65-cbb4dd965-lmsf5",
            "x-greenflash-delivery": "1dbe3e1e-e1a9-4a69-9520-bad6cae85141",
            "x-greenflash-event": "conversation.quality_index",
            "x-greenflash-signature": "v1=b097c376b885acfdc95ac5a44ff3b3e3d796dfec9461f594e20c857e199d55c9",
            "x-greenflash-timestamp": "1759868755",
            "x-greenflash-version": "2025-09-01",
            "x-is-trusted": "yes",
            "x-real-ip": "54.67.33.246",
            "x-vercel-id": "sfo1::56j9l-1759868755258-dd86a6217096"
          },
          "params": {},
          "query": {},
          "body": {
            "metadata": {
              "productId": null,
              "conversationId": "conv_test_123"
            },
            "eventType": "conversation.quality_index",
            "version": "2025-09-01",
            "payload": {
              "conversation": {
                "qualityIndex": {
                  "current": 85,
                  "previous": 78
                },
                "insights": [
                  "Response time improved 15%",
                  "User satisfaction up",
                  "Resolution rate at 92%"
                ]
              }
            },
            "deliveryId": "1dbe3e1e-e1a9-4a69-9520-bad6cae85141",
            "testEvent": true
          },
          "webhookUrl": "https://greenflash.app.n8n.cloud/webhook-test/8cb66e40-9ad3-44da-9074-03e87c646335",
          "executionMode": "test"
        }
      }
    ]
  },
  "connections": {
    "Catch Greenflash webhook": {
      "main": [
        [
          {
            "node": "Verify webhook signature",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Verify webhook signature": {
      "main": [
        [
          {
            "node": "Send an alert to Slack",
            "type": "main",
            "index": 0
          },
          {
            "node": "Create a ticket",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "47c01101-9d5d-4d68-98c3-1f75a993713a",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "ab6506a85524cf26e35005c2400b4a95893a831074a593d68c57d0bcd0f1ddac"
  },
  "id": "uf194yW6ixI1Bhfy",
  "tags": []
}
```

This workflow:

1. Receives quality events from Greenflash webhooks and validates the webhook signature
2. Filters for conversations with quality index below 60%
3. Sends formatted alerts to your Slack channel
4. Creates high-priority Zendesk tickets with conversation context

### Common n8n use cases

**Advanced Problem Response:**

* **Multi-channel alerting** (Slack + email + SMS) based on severity
* **Automatic escalation paths** with time-based logic
* **Conversation transcript archival** to data warehouses

**Growth & Revenue Automation:**

* **Lead scoring pipelines** that qualify prospects based on engagement
* **Dynamic personalization** triggers based on conversation patterns
* **A/B test routing** when users meet specific criteria
* **Customer journey mapping** with sequential webhook tracking
* **Feature adoption alerts** when users discover new capabilities

## Direct Slack integration

### Native Slack webhooks

For teams that live in Slack, you can connect Greenflash directly to Slack without any middleware. This gives you instant notifications with zero setup complexity.

#### Setting up Slack incoming webhooks

1. **Create an app** in your Slack workspace (or use an existing one)
2. **Enable Incoming Webhooks** in your app settings
3. **Add a webhook** to your desired channel
4. **Copy the webhook URL** (looks like `https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXX`)
5. **Add to Greenflash** webhook settings with these configurations:
   * URL: Your Slack webhook URL
   * Events: Select which Greenflash events to monitor
   * Transform: Enable Slack formatting in webhook settings

#### Example Slack message formatting

When Greenflash sends events to Slack, they appear as rich, actionable messages:

```json theme={"theme":{"light":"github-light","dark":"vesper"}}
{
  "blocks": [
    {
      "type": "header",
      "text": {
        "type": "plain_text",
        "text": "🎯 High Engagement User Detected"
      }
    },
    {
      "type": "section",
      "fields": [
        {"type": "mrkdwn", "text": "*User:* user@example.com"},
        {"type": "mrkdwn", "text": "*Sentiment:* 92%"},
        {"type": "mrkdwn", "text": "*Messages:* 47"},
        {"type": "mrkdwn", "text": "*Quality Index:* 88"}
      ]
    },
    {
      "type": "actions",
      "elements": [
        {
          "type": "button",
          "text": {"type": "plain_text", "text": "View in Greenflash"},
          "url": "https://app.greenflash.ai/conversations/conv_123"
        },
        {
          "type": "button",
          "text": {"type": "plain_text", "text": "Add to CRM"},
          "url": "https://your-crm.com/quick-add"
        }
      ]
    }
  ]
}
```

### Slack bot integrations

For more sophisticated interactions, build a Slack bot that:

* **Responds to commands** like `/greenflash stats` to get real-time metrics
* **Posts summaries** of daily conversation quality to specific channels
* **Enables two-way sync** to mark conversations as reviewed from Slack
* **Triggers actions** like "Assign to Support" directly from Slack buttons

### Common Slack workflows

**Real-time Monitoring:**

* Quality alerts to `#eng-oncall` when PQI drops
* New conversation notifications to `#customer-success`
* Sentiment warnings to `#product-feedback`

**Opportunity Alerts:**

* Hot leads to `#sales-signals` when engagement spikes
* Upsell opportunities to `#account-management`
* Champion users to `#customer-advocacy`
* Feature requests to `#product-ideas`

**Team Coordination:**

* Daily quality summaries to `#standup`
* Weekly trend reports to `#leadership`
* Milestone celebrations to `#wins`

## Key webhook considerations

When building webhook-triggered workflows, keep these critical factors in mind:

### Event selection

* Start with high-impact events like `conversation.quality_index` and `conversation.sentiment`
* Avoid subscribing to all events initially—this can overwhelm your workflows
* Use test deliveries to understand payload structure before building complex logic

### Data handling

* **Parse JSON carefully**: Webhook payloads contain nested objects with conversation context
* **Store conversation IDs**: You'll need these for API callbacks and audit trails
* **Handle arrays**: Some events include message arrays that need iteration

### Timing and retries

* Workflows should respond within 5 seconds to avoid timeout retries
* Use asynchronous processing for heavy operations
* Implement idempotency—webhooks may be delivered multiple times

### Security

* Keep webhook URLs private and rotate them if compromised
* Verify signatures if your platform supports custom code (see webhook verification docs)
* Use environment variables for sensitive data like API keys

### Filtering and thresholds

* Not every quality dip requires the same response
* Build conditional logic based on:
  * Severity (how low did quality drop?)
  * Frequency (is this a pattern or anomaly?)
  * Context (which product/user/time of day?)
  * Business impact (paid vs free tier users)

## Best practices for automation

### Start simple, iterate often

Begin with basic alerting workflows and gradually add complexity as you learn patterns. A simple Slack notification is better than a complex workflow that breaks.

### Monitor your monitors

Track workflow execution rates and failures. If your automation stops working, you lose visibility into quality issues.

### Build escalation layers

* **Level 1**: Automated responses (canned messages, FAQ links)
* **Level 2**: Team notifications (Slack, email)
* **Level 3**: Ticket creation (Zendesk, Jira)
* **Level 4**: Page on-call engineer (PagerDuty)

### Document your workflows

Future you (and your team) will thank you for clear documentation on:

* What triggers each workflow
* What actions it takes
* Who gets notified
* How to disable in emergencies

### Test with real scenarios

Use Greenflash's test delivery feature to send actual payloads through your workflows. Test both happy paths and edge cases.

## Example automation recipes

### 🚨 Problem Response Recipes

#### Recipe 1: Customer success handoff

**Trigger**: Conversation sentiment drops below -0.5
**Actions**:

1. Check customer tier in CRM
2. If paid customer, immediately assign to CS team
3. Send personalized email with support escalation link
4. Log interaction in customer timeline

#### Recipe 2: Proactive recovery

**Trigger**: Product Quality Index drops below 60
**Actions**:

1. Pause non-critical AI features
2. Route new conversations to higher-quality model
3. Alert engineering team with diagnostic data
4. Enable verbose logging for debugging
5. Create incident report template

### 💰 Opportunity Capture Recipes

#### Recipe 3: Sales qualification pipeline

**Trigger**: User engagement exceeds 80% with positive sentiment
**Actions**:

1. Calculate lead score based on conversation depth
2. Enrich contact data via Clearbit
3. Create qualified lead in Salesforce
4. Assign to sales rep based on territory
5. Trigger personalized outreach sequence
6. Send Slack notification to sales team

#### Recipe 4: Champion user identification

**Trigger**: Conversation rating of 5 stars
**Actions**:

1. Add user to "Champions" segment
2. Send thank you email with referral incentive
3. Invite to beta testing program
4. Create case study opportunity in Notion
5. Schedule customer success check-in

#### Recipe 5: Upsell opportunity detection

**Trigger**: User hits usage limits with high satisfaction
**Actions**:

1. Check current subscription tier
2. Calculate potential expansion revenue
3. Create upsell task in HubSpot
4. Send usage report to account manager
5. Trigger upgrade email campaign
6. Add to quarterly business review agenda

### 📊 Intelligence Gathering Recipes

#### Recipe 6: Product feedback mining

**Trigger**: Any conversation with specific keywords
**Actions**:

1. Extract feature requests using NLP
2. Categorize by product area
3. Add to product roadmap database
4. Calculate request frequency
5. Update feature priority scores
6. Notify PM when threshold reached

#### Recipe 7: Training data harvesting

**Trigger**: Conversation quality index above 90%
**Actions**:

1. Export full conversation transcript
2. Anonymize personally identifiable information
3. Tag with quality metrics and outcomes
4. Add to training dataset in S3
5. Trigger model retraining pipeline
6. Log in ML experiment tracker

### 🎯 Personalization Recipes

#### Recipe 8: Dynamic experience optimization

**Trigger**: User behavior patterns detected
**Actions**:

1. Update user preference profile
2. Adjust AI model parameters
3. Modify conversation style
4. Enable advanced features
5. Customize UI elements via feature flags
6. Track personalization impact

## Getting help

* Review the [Webhooks documentation](/intro/webhooks) for payload structures and verification
* Test your workflows with sample events before going live
* Check Greenflash webhook logs for delivery status and debugging
* Join our community for workflow templates and best practices

## Additional workflow opportunities

Beyond quality monitoring and sales enablement, consider these powerful use cases:

### Compliance & Governance

* **Audit logging** for regulated industries
* **Content moderation** triggers for safety issues
* **Data retention** workflows for GDPR compliance
* **Access control** alerts for security events

### Customer Journey Optimization

* **Onboarding progress** tracking and nudges
* **Feature adoption** campaigns based on usage
* **Churn prediction** and intervention workflows
* **Milestone celebrations** and gamification

### Operational Intelligence

* **Cost optimization** when usage patterns change
* **Capacity planning** based on conversation volume
* **Performance benchmarking** against SLAs
* **Competitive intelligence** from user feedback

### Community & Growth

* **Referral program** triggers for advocates
* **Community badges** for active users
* **Content creation** opportunities from FAQs
* **Partnership signals** from enterprise users

Transform every conversation into actionable intelligence. Whether you're preventing problems, capturing opportunities, or gathering insights, Greenflash webhooks ensure you never miss a signal that matters.
