Guides / SaaS

Trigger a Webhook When Trial Conversions Hit a Goal

4 min read·SaaS

The Use Case

You want to know the moment you hit 10 trial conversions in a day — either to celebrate as a team, trigger a marketing workflow, or update a growth dashboard. Smart Actions fires a webhook when the count crosses your threshold.

Step 1: Log Trial Conversions

ts
// Stripe webhook: customer.subscription.updated (trial_end → active)
if (event.type === "customer.subscription.updated") {
  const sub = event.data.object;
  const converted = sub.status === "active" && sub.trial_end && Date.now() / 1000 > sub.trial_end;
  if (converted) {
    await logit.now("conversions", {
      event: "Trial converted to paid",
      description: `Customer ${sub.customer} upgraded to ${sub.items.data[0]?.price.nickname ?? "paid"}`,
      icon: "💰",
      notify: true,
      tags: { plan: sub.items.data[0]?.price.nickname ?? "unknown" },
      metadata: {
        subscriptionId: sub.id,
        customerId: sub.customer,
        mrr: sub.items.data[0]?.price.unit_amount,
      },
    });
  }
}

Step 2: Create a Milestone Rule

FieldValue
Name10 conversions today
Channelconversions
Event nameTrial converted to paid
Threshold10
Window24 hours
Cooldown24 hours
ActionWebhook
URLYour internal API, Zapier, or n8n endpoint

The 24-hour cooldown ensures the rule fires once per day — when you hit 10 conversions, you get one notification, not a cascade.

Step 3: Handle the Webhook

ts
// Your webhook endpoint
export async function POST(req: Request) {
  const body = await req.json();
  // body.rule = "10 conversions today"
  // body.eventCount = 10
  // body.channel = "conversions"

  // Send a Slack celebration message, update a Notion tracker, etc.
  await postToSlack("#wins", `🎉 We hit 10 paid conversions today!`);
  return Response.json({ ok: true });
}

Tips

  • Set separate rules for 10, 25, and 50 conversions to mark progressive milestones.
  • Use window = 24h + cooldown = 24h to get a "daily goal hit" notification pattern.
  • Log mrr in metadata so you can query total MRR added when the webhook fires.

Try LogIt free

7-day trial. No credit card required.

Start free