MCP + REST · Lovable

Add the official WhatsApp API to your Lovable app

Use Lovable’s custom MCP connector to set up and test WhatsApp while you build; your running app sends messages through a backend function with the token as a secret.

Create a free account →Create free account →
custom MCP connectorOAuthbackend functionsecrets

How it fits together

In Lovable, a custom MCP server is a personal chat connector: it gives Lovable live context and tools while you build. It is not part of the app you publish, and published-app users do not get it. So the setup has two parts: use the MCP connector to create the account and test WhatsApp, then have your app call the Gambot REST API from backend code with the token stored as a secret.

Requirements

  • No Gambot account yet? Connect the server without a token and ask your agent to “set up WhatsApp with Gambot”. It creates a free-trial account for you (no API key needed) and hands you one link to connect your WhatsApp number to Meta in the browser — that single step must be done by a person. Prefer the browser? Create an account.
  • After WhatsApp is connected, copy your API token (gmbt_…) from Settings → General into an environment variable — never into the chat. Where the client supports it, sign in with OAuth on the hosted server instead and there is no token to copy.
  • Never put the token in front-end code: the browser would expose it. Keep it in a backend function secret.

Setup

1

Add the custom MCP connector

In Lovable open Connectors, scroll to the bottom of the All view and choose the Custom MCP card. Name it Gambot, paste the URL below, keep OAuth selected and click Add & authorize.

2

Set up WhatsApp in chat

Ask: “Use Gambot to set up the official WhatsApp API.” It creates the account and gives you the Meta connection link to open in a browser.

3

Store the token as a secret

Ask Lovable to add a backend function for sending WhatsApp messages and to store GAMBOT_TOKEN as a secret for it.

4

Wire the UI

The front end calls your backend function; the function calls Gambot. Ask Lovable to check the 24-hour window and fall back to a template.

MCP server URL for the Lovable connector

https://gambot-mcp.azurewebsites.net/mcp

What the backend function should call

POST https://api.gambot.co.il/api/v1/messages/send-text
Authorization: Bearer <GAMBOT_TOKEN from the function secret>
Content-Type: application/json

{ "to": "12025550123", "text": "Your booking is confirmed." }

# Outside the 24-hour window use /messages/send-template with an approved templateId.

Example prompts

You Use the Gambot connector to set up WhatsApp for this app and tell me what I need to do in the browser.

You Add a backend function that sends a WhatsApp message through the Gambot REST API using a GAMBOT_TOKEN secret. Never expose the token to the browser.

You When a customer submits the booking form, send them a WhatsApp confirmation; use a template if the 24-hour window is closed.

Troubleshooting

  • Tools not showing? Restart the client after editing its MCP config, then check its MCP/tools panel for “gambot”.
  • AUTHENTICATION_REQUIRED? The token is missing or invalid. Copy a fresh one from Settings → General.
  • CONVERSATION_WINDOW_CLOSED? The 24-hour window is closed — send an approved template instead. This is WhatsApp behavior, and the error tells the agent exactly that (template_required: true).
  • Is the WhatsApp number connected? Ask the agent to run gambot_setup_whatsapp_integration; it reports the exact state and the next step.
  • The connector does not appear in a published app by design — chat connectors only help while building. Use the backend function for the running app.
  • Some workspaces restrict custom MCP connectors; ask a workspace admin if the Custom MCP card is missing.

Related

Add WhatsApp to your Lovable app

Connect the MCP server, finish the Meta step, then let your backend send the first message.

Frequently asked questions

How do I add the official WhatsApp API to my application using Lovable?

Add the Gambot MCP server (https://gambot-mcp.azurewebsites.net/mcp) as a custom MCP connector so Lovable can set up your account and test WhatsApp, then have your app send messages from a backend function that calls https://api.gambot.co.il/api/v1/messages/send-text with the API token stored as a secret.

Does the MCP connector work inside my published app?

No. Lovable chat connectors give context while you build and are not available to published-app users. Use the REST API from backend code in the running app.

Is this the official WhatsApp Business API?

Yes. Gambot is a Meta Business Solution Provider; there is no WhatsApp Web session or QR code.