Collect Customer.io debug evidence for support.
Use when creating support tickets, reporting issues,
or documenting integration problems.
Trigger with phrases like "customer.io debug", "customer.io support ticket",
"collect customer.io logs", "customer.io diagnostics".
!node --version 2>/dev/null || echo 'Node.js: not installed'
!npm list customerio-node 2>/dev/null | grep customerio || echo 'customerio-node: not installed'
Overview
Collect a comprehensive debug bundle for Customer.io support tickets: API connectivity tests, user profile inspection, SDK version info, environment validation, and a structured support report.
Prerequisites
Customer.io API credentials configured
curl available for API tests
User ID or email of the affected user/delivery
Instructions
Step 1: API Connectivity Diagnostic
#!/usr/bin/env bash
set -euo pipefail
echo "=== Customer.io Debug Bundle ==="
echo "Timestamp: $(date -u +%Y-%m-%dT%H:%M:%SZ)"
echo ""
# 1. Check Customer.io status
echo "--- Platform Status ---"
curl -s "https://status.customer.io/api/v2/status.json" \
| python3 -c "import sys,json; d=json.load(sys.stdin); print(f'Status: {d[\"status\"][\"description\"]}')" \
2>/dev/null || echo "Could not reach status page"
# 2. Test Track API authentication
echo ""
echo "--- Track API Auth ---"
TRACK_RESULT=$(curl -s -o /dev/null -w "%{http_code}" \
-u "${CUSTOMERIO_SITE_ID}:${CUSTOMERIO_TRACK_API_KEY}" \
-X PUT "https://track.customer.io/api/v1/customers/debug-test-$(date +%s)" \
-H "Content-Type: application/json" \
-d '{"email":"[email protected]"}')
echo "Track API: HTTP ${TRACK_RESULT}"
# 3. Test App API authentication
echo ""
echo "--- App API Auth ---"
APP_RESULT=$(curl -s -o /dev/null -w "%{http_code}" \
-H "Authorization: Bearer ${CUSTOMERIO_APP_API_KEY}" \
"https://api.customer.io/v1/campaigns")
echo "App API: HTTP ${APP_RESULT}"
# 4. DNS and latency
echo ""
echo "--- Network Diagnostics ---"
for host in track.customer.io api.customer.io; do
LATENCY=$(curl -s -o /dev/null -w "%{time_total}" "https://${host}")
echo "${host}: ${LATENCY}s"
done
Step 2: User Profile Investigation
// scripts/debug-user.ts
// Investigate a specific user's state in Customer.io
import { TrackClient, APIClient, RegionUS } from "customerio-node";
async function investigateUser(userId: string) {
const cio = new TrackClient(
process.env.CUSTOMERIO_SITE_ID!,
process.env.CUSTOMERIO_TRACK_API_KEY!,
{ region: RegionUS }
);
console.log(`\n=== User Investigation: ${userId} ===\n`);
// Test if we can identify (update) the user — confirms they exist
try {
await cio.identify(userId, {
_debug_checked_at: Math.floor(Date.now() / 1000),
});
console.log("Profile: EXISTS (identify succeeded)");
} catch (err: any) {
console.log(`Profile: ERROR (${err.statusCode}: ${err.message})`);
}
// Test if we can track an event on the user
try {
await cio.track(userId, {
name: "debug_check",
data: { checked_at: new Date().toISOString() },
});
console.log("Event tracking: WORKING");
} catch (err: any) {
console.log(`Event tracking: ERROR (${err.statusCode}: ${err.message})`);
}
// Check suppression status by trying to unsuppress
// (If user is not suppressed, this is a no-op)
console.log("\nNote: Check suppression status in Customer.io dashboard:");
console.log(` People > Search "${userId}" > check Suppressed badge`);
console.log(" Also check Activity tab for bounce/complaint events");
}
const userId = process.argv[2];
if (!userId) {
console.error("Usage: npx tsx scripts/debug-user.ts <user-id>");
process.exit(1);
}
investigateUser(userId);