How do I send build notifications to Google Chat?

Last updated: July 23, 2026

Context

Unlike Slack, Codemagic does not have a native Google Chat integration. However, you can use Google Chat's incoming webhooks along with Codemagic's post-build and post-publishing scripts to send build result notifications to a Google Chat space.

Answer

Follow these steps to set up Google Chat build notifications in Codemagic:

  1. Create an incoming webhook in your Google Chat space. In your Google Chat space, go to Apps & Integrations, then add a new webhook. Copy the generated webhook URL.

  2. Store the webhook URL as a Codemagic secret environment variable. In your Codemagic app settings, add the webhook URL as an environment variable (for example, GOOGLE_CHAT_WEBHOOK).

  3. Add a post-build script to mark a successful build. In the Post-build script section, add the following command:

    touch ~/SUCCESS

    This creates a marker file only when the build steps complete successfully. Since the publishing step runs even if the build fails, this file is used later to determine the actual build outcome.

    Image of a Google Chat integration guide showing a post-build script that creates a SUCCESS file to indicate a successful build and a curl-based step to notify Google Chat.
  4. Add a post-publishing script to send the notification. In the Post-publishing script section, add the following script:

    if [ -f ~/SUCCESS ]; then
      BUILD_STATUS="success"
    
      ACTIONS=$(curl -s \
        -H "x-auth-token: $CODEMAGIC_API_TOKEN" \
        "https://codemagic.io/api/v3/builds/$CM_BUILD_ID/actions")
    
      PUBLISHING_STATUS=$(echo "$ACTIONS" | \
        jq -r '.data[]? | select(.type=="publishing") | .status // empty')
    
      if [ "$PUBLISHING_STATUS" = "failed" ] || [ "$PUBLISHING_STATUS" = "canceled" ]; then
        BUILD_STATUS="failed"
      fi
    else
      BUILD_STATUS="failed"
    fi
    
    
    if [ "$BUILD_STATUS" = "success" ]; then
      STATUS="✅ Build succeeded"
    else
      STATUS="❌ Build failed"
    fi
    
    
    curl -s -X POST "$GOOGLE_CHAT_WEBHOOK" \
      -H "Content-Type: application/json; charset=UTF-8" \
      -d "{
        \"text\": \"$STATUS
    
    Workflow: $CM_WORKFLOW_NAME
    Branch: $CM_BRANCH
    Commit: ${CM_COMMIT:0:7}
    
    Build URL:
    https://codemagic.io/app/$CM_PROJECT_ID/build/$CM_BUILD_ID\"
      }"
    Image of a set of step-by-step instructions and code snippet describing how to send build results to Google Chat via a webhook and post-build scripts.

This setup ensures that Google Chat receives a notification with the build status (success or failure), workflow name, branch, commit hash, and a direct link to the build — regardless of whether the build succeeded or failed.