Skip to content

Instantly share code, notes, and snippets.

@tomredman
tomredman / webhooks.ts
Created February 16, 2024 17:37
Accepting & verifying Facebook webhooks in NextJS
import crypto from "crypto";
import type { NextApiRequest, NextApiResponse } from "next";
import { buffer } from "micro";
export const config = {
api: {
bodyParser: false,
},
};
@tomredman
tomredman / .cursorrules
Created January 22, 2025 22:12
.cursorrules for project using Convex, Typescript, React 19, shadcn, TanStack *, etc.
{
"recommendations": {
"convex": {
"fileStructure": {
"queries": "convex/{feature}/queries.ts",
"mutations": "convex/{feature}/mutations.ts",
"actions": "convex/{feature}/actions.ts"
},
"rules": [
"Actions must include 'use node' when using Node.js packages",
@tomredman
tomredman / convex-automation-buildEmailPayload.ts
Created August 13, 2025 23:11
Sending batch emails with Convex & Resend
/**
* Builds an email payload for sending campaign emails through an email service provider.
*
* This function takes campaign details and recipient information to construct a complete
* email payload that includes:
* - Sender information (from name and email)
* - Recipient email
* - Subject line
* - Reply-to address
* - Unsubscribe URL (merged into both HTML and plain text content)