All skills

Cursor skill

WhatsApp Skill for Cursor

Drop-in Cursor rule that teaches the AI to send WhatsApp messages, broadcasts, and webhooks via the Gavi WhatsApp API.

Install

  1. 1. Save the skill content below as.cursor/rules/gaviwhatsapp.mdin your project (or user config) directory.
  2. 2. Install the SDK:
    npm install @gaviwhatsapp/whatsapp
  3. 3. Set the API key environment variable:
    GAVIVENTURES_API_KEY=gv_...
    Get a key →
  4. 4. Restart Cursor. The agent will now know how to use the Gavi WhatsApp API when you ask it to send messages.

GaviVentures WhatsApp API — Cursor Skill

Use this skill whenever the user asks to send WhatsApp messages, add WhatsApp notifications, or integrate WhatsApp into their application.

Setup

  1. Install the SDK:
npm install @gaviwhatsapp/whatsapp
  1. Set the environment variable:
GAVIVENTURES_API_KEY=gv_...

Get an API key at https://www.gaviventures.com/whatsapp/settings/api-keys

Send a Text Message

import { WhatsApp } from '@gaviwhatsapp/whatsapp'

const wa = new WhatsApp({ apiKey: process.env.GAVIVENTURES_API_KEY! })

await wa.send({ to: '+919876543210', text: 'Hello from my app!' })

Send a Template Message

Templates are pre-approved message formats required for initiating conversations.

await wa.sendTemplate({
  to: '+919876543210',
  template: 'order_confirmation',
  language: 'en',
  variables: { '1': 'ORD-1234', '2': '$49.99' },
})

Send Media (Image, Document, Video)

await wa.sendMedia({
  to: '+919876543210',
  type: 'image',
  url: 'https://example.com/receipt.png',
  caption: 'Your receipt',
})

await wa.sendMedia({
  to: '+919876543210',
  type: 'document',
  url: 'https://example.com/invoice.pdf',
  filename: 'invoice.pdf',
})

List Templates

const templates = await wa.getTemplates()
// Returns: { templates: [{ name, status, category, language, ... }] }

Send Broadcast

await wa.broadcast({
  recipients: ['+919876543210', '+919876543211'],
  template: 'promo_offer',
  language: 'en',
  variables_per_recipient: [
    { '1': 'Alice', '2': '20%' },
    { '1': 'Bob', '2': '15%' },
  ],
})

Register a Webhook

Receive real-time delivery updates and incoming messages.

const webhook = await wa.registerWebhook({
  url: 'https://myapp.com/api/whatsapp-webhook',
  events: ['message.received', 'message.delivered', 'message.read'],
})
// webhook.secret — use to verify HMAC signatures

REST API (direct)

If not using the SDK, call the API directly:

MethodEndpointDescription
POST/api/v1/messages/sendSend text message
POST/api/v1/messages/templateSend template message
POST/api/v1/messages/mediaSend media message
GET/api/v1/messages?phone=+91...Get message history
GET/api/v1/templatesList templates
POST/api/v1/broadcastsSend broadcast
GET/api/v1/webhooksList webhooks
POST/api/v1/webhooksRegister webhook

All requests require Authorization: Bearer <api_key> header.

Base URL: https://www.gaviventures.com

Common Patterns

Next.js API Route (order notification)

// app/api/orders/route.ts
import { WhatsApp } from '@gaviwhatsapp/whatsapp'

const wa = new WhatsApp({ apiKey: process.env.GAVIVENTURES_API_KEY! })

export async function POST(req: Request) {
  const order = await req.json()

  await wa.sendTemplate({
    to: order.customerPhone,
    template: 'order_confirmation',
    language: 'en',
    variables: { '1': order.id, '2': order.total },
  })

  return Response.json({ success: true })
}

Next.js Webhook Handler

// app/api/whatsapp-webhook/route.ts
export async function POST(req: Request) {
  const payload = await req.json()

  if (payload.event === 'message.received') {
    console.log(`New message from ${payload.from}: ${payload.text}`)
  }

  return Response.json({ ok: true })
}

Important Notes

  • Phone numbers must include country code (e.g., +919876543210)
  • Template messages must be approved by Meta before sending
  • You need a connected WhatsApp Business Account (set up in the dashboard)
  • Message costs are billed directly by Meta to the user's Business Account. Meta's pricing changes frequently — see the current rates at https://business.whatsapp.com/products/platform-pricing

Other skills

Ready to send your first message?

Get an API key and have Cursor send a WhatsApp message in under 5 minutes.