Integrations / GPT

GPT logo

AI & agents · Function calling / Custom GPT Actions

GPT + Sendjade

Let an OpenAI model send WhatsApp messages and answer customers using function calling.

Works with the live API

What you can automate

  • An assistant that sends an invoice when asked
  • Auto-draft replies to incoming messages for human approval
  • A support bot that looks up orders then replies

Before you start

  • A Sendjade account with a connected instance (status Authorized). See Getting started.
  • Your **idInstance** (shown on the instance page in the console) and **apiTokenInstance** (shown once when you created the instance; press Generate new token if you lost it). Use a spare number while testing.
  • An OpenAI API key (or a Custom GPT with Actions).

Set it up

  1. Define the tool

    Give the model a function it can call.

    Tool definition
    {
      "type": "function",
      "function": {
        "name": "send_whatsapp_message",
        "description": "Send a WhatsApp message to a customer from the business number.",
        "parameters": {
          "type": "object",
          "properties": {
            "to": { "type": "string", "description": "Phone in international format, digits only, e.g. 2348012345678" },
            "text": { "type": "string" }
          },
          "required": ["to", "text"]
        }
      }
    }
  2. Handle the call

    When the model returns a tool call, run it against Sendjade. Always require human confirmation for outbound messages in production.

    Node.js
    async function sendWhatsapp({ to, text }) {
      const url = 'https://api.sendjade.com/waInstance' + process.env.SENDJADE_ID_INSTANCE + '/sendMessage/' + process.env.SENDJADE_TOKEN_INSTANCE;
      const r = await fetch(url, {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify({ chatId: String(to).replace(/\D/g, ''), message: text }),
      });
      return { status: r.status, body: await r.json() };
    }
  3. Custom GPT Actions (alternative)

    In a Custom GPT add an Action with an OpenAPI schema for POST /waInstance{idInstance}/sendMessage/{apiTokenInstance}. Fix the idInstance in the schema so the GPT cannot choose another number, and keep the token out of the instructions.

Test it

Ask the assistant: "Message <your number> that the invoice is ready". Confirm the tool call, then check your phone.

Troubleshooting

The model sends messages I did not intend

Add an approval step before the tool runs, restrict recipients to a known list, and rely on the daily cap and opt-out list as a safety net.

I get 401 unauthorized

The idInstance or token in the URL is wrong. Copy both again from the console. Generating a new token makes the old one stop working immediately.

I get 409 instance_not_connected

The instance is not Authorized yet. Open it in the console, press Connect and scan the QR code.

I get 400 invalid_chat_id

Use international format with digits only, e.g. 2348012345678 (or 2348012345678@c.us). Remove spaces, dashes and the leading zero of the local number.

I get 422 recipient_opted_out

That person replied STOP (or was added to the opt-out list). Sendjade refuses to message them. Remove the number from Opt-outs only if they asked to hear from you again.

I get 429 daily_limit_reached or rate_limited

The number reached its 24-hour sending cap (default 500) or you are calling too fast. The cap protects your number from restriction. Slow down, and raise the cap only if your volume is genuine.

Ask AI to help me integrate GPT

Copy this prompt into ChatGPT, Claude or any assistant. It already knows Sendjade’s API, so the answer matches our endpoints.

The prompt is plain text that you copy yourself. Never paste real keys into an assistant; use placeholders.