Back to GrowthCues Core
Headless GTMBigQuerySegmentExpansion Velocity

Automate Expansion Velocity alerts with GitHub Actions/Python on BigQuery using Segment and GrowthCues Core

Implement $0 Expansion Velocity monitoring. Learn to set up GitHub Actions/Python to trigger proactive alerts from BigQuery data via Segment and GrowthCues Core's semantic layer.

For: GTM Engineers, RevOps

Implement $0 Expansion Velocity monitoring. Learn to set up GitHub Actions/Python to trigger proactive alerts from BigQuery data via Segment and GrowthCues Core's semantic layer.

The Context Problem: Escaping Reactive GTM Dashboards

Traditional dashboards often present GTM metrics reactively – by the time you see a "red" health score or a dip in usage, the opportunity for proactive intervention has passed. Building real-time, automated alerts for complex B2B signals like Expansion Velocity directly from your BigQuery typically involves brittle custom SQL and complex orchestration. This "logic gap" means GTM Engineers and RevOps teams spend more time extracting insights than acting on them.

GrowthCues Core provides the standardized, AI-ready metrics you need to power effective, headless GTM automation.

Architecture: Headless GTM Automation with GrowthCues Core

This diagram illustrates how GrowthCues Core transforms raw Segment events in your BigQuery into actionable Expansion Velocity signals, which are then used by GitHub Actions/Python to trigger automated alerts.

The "GrowthCues Core" Code Block: Automating Expansion Velocity Monitoring

GrowthCues Core calculates essential B2B GTM metrics, including Expansion Velocity, directly in your BigQuery. This open-source semantic layer provides reliable, standardized definitions.

Here’s a simplified Python snippet from a GitHub Actions workflow that queries GrowthCues Core for Expansion Velocity thresholds in BigQuery and triggers an alert:

# main.py - simplified Python script for GitHub Actions
import os
from google.cloud import bigquery # or snowflake.connector for Snowflake

def get_alerts():
    client = bigquery.Client(project=os.environ.get("GCP_PROJECT_ID")) # Adjust for Snowflake
    
    # Query GrowthCues Core's fct_account_metrics_daily (or other relevant table)
    # The specific table and column will depend on CORE_METRIC_CONCEPT
    # Example for "Silent Churn" (volume_change_ratio_7d < 0.5)
    # Example for "Expansion Velocity" (net_new_users_7d > X)
    # Example for "PQL Activity" (pql_score > Y)
    # Example for "Team Activation" (team_activation_score < Z)
    
    # Placeholder for dynamic metric query logic
    metric_column = "" 
    threshold = 0.0
    operator = "<"
    if "Expansion Velocity" == "Silent Churn":
        metric_column = "volume_change_ratio_7d"
        threshold = 0.5
        operator = "<"
    elif "Expansion Velocity" == "Expansion Velocity":
        metric_column = "net_new_users_7d"
        threshold = 5 # Example: 5 new users in 7 days
        operator = ">"
    elif "Expansion Velocity" == "PQL Activity":
        metric_column = "pql_score"
        threshold = 70 # Example: PQL Score > 70
        operator = ">"
    elif "Expansion Velocity" == "Team Activation":
        metric_column = "team_activation_score"
        threshold = 0.6 # Example: Team Activation Score < 0.6 (low activation)
        operator = "<"

    query = f"""
    SELECT
        account_id,
        {metric_column} as metric_value,
        metric_date
    FROM `your_project.growthcues_core.fct_account_metrics_daily`
    WHERE metric_date = DATE_SUB(CURRENT_DATE(), INTERVAL 1 DAY)
        AND {metric_column} {operator} {threshold}
        AND {metric_column} IS NOT NULL
    LIMIT 5
    """
    
    query_job = client.query(query)
    results = query_job.result()
    
    alerts = []
    for row in results:
        alerts.append(f"Account {row.account_id}: Expansion Velocity Alert (Value: {row.metric_value:.2f})")
    return alerts

if __name__ == "__main__":
    triggered_alerts = get_alerts()
    if triggered_alerts:
        print(f"Detected {len(triggered_alerts)} GTM alerts:")
        for alert in triggered_alerts:
            # In a real scenario, this would post to Slack, send email, etc.
            print(alert) 
    else:
        print(f"No Expansion Velocity alerts detected.")

Note: Replace your_project.growthcues_core.fct_account_metrics_daily with your actual table reference. The metric_column, threshold, and operator logic in the Python script would be dynamically generated or configured based on Expansion Velocity.

Step-by-Step: Implement Headless GTM Automation with GrowthCues Core

  1. Deploy GrowthCues Core: Clone the GrowthCues Core dbt project and deploy it to your BigQuery, configuring it to consume raw event data from Segment.
  2. Identify Core Metric: Use GrowthCues Core to calculate standardized Expansion Velocity from your product data in BigQuery.
  3. Develop Automation Script: Write a Python script (or similar) that queries the relevant GrowthCues Core output table in your BigQuery for specific thresholds or anomalies related to Expansion Velocity.
  4. Configure GitHub Actions/Python Workflow: Set up a scheduled GitHub Actions/Python workflow (e.g., GitHub Actions, Airflow, Prefect) to execute your script daily or at a desired frequency.
  5. Trigger Proactive Alerts: Integrate your script with communication tools (e.g., Slack, email, PagerDuty) or CRM to deliver proactive Expansion Velocity alerts to your GTM Engineers, RevOps at the right time.

The GrowthCues Core Advantage: AI-Ready, Open-Source, and Standardized

  • AI-Ready Data: Eliminates LLM hallucinations by providing structured context directly in your data warehouse.
  • Standardized Metrics: Ensures a single source of truth for all B2B GTM metrics, solving the "Truth Gap."
  • Open-Source & Extensible: MIT-licensed, offering full transparency, control, and customization over your core GTM logic.
  • Reduced Maintenance: Replaces brittle custom SQL with robust, community-driven dbt models.

Further Reading

Ready to transform your BigQuery into a proactive GTM intelligence engine?

Star GrowthCues Core on GitHub

Ready to Build with GrowthCues Core?

Open-source dbt models for product-led GTM. Start building standardized, AI-ready metrics in your data warehouse.

View on GitHub

Open Source • MIT License • Community Supported