Skip to main content
Glama
ExoCubeYT

OpenWA MCP Server

by ExoCubeYT

create_webhook

Subscribe to WhatsApp events by creating a webhook that sends event data to a specified URL. Configure event types and optional signing secret.

Instructions

Create a new webhook to receive WhatsApp events at a URL

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sessionIdYesSession ID
urlYesWebhook endpoint URL
eventsYesArray of event types to subscribe to
secretNoOptional webhook signing secret

Implementation Reference

  • Handler function for the create_webhook tool. Sends a POST request to the OpenWA API to create a new webhook with url, events, and optional secret.
      async ({ sessionId, url, events, secret }) => {
        const data = await openwaClient({
          method: "POST",
          path: `/sessions/${sessionId}/webhooks`,
          body: { url, events, secret },
        });
        return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] };
      }
    );
  • Schema definition for the create_webhook tool with sessionId, url, events (string array), and optional secret parameters.
    {
      description: "Create a new webhook to receive WhatsApp events at a URL",
      inputSchema: {
        sessionId: z.string().describe("Session ID"),
        url: z.string().describe("Webhook endpoint URL"),
        events: z.array(z.string()).describe("Array of event types to subscribe to"),
        secret: z.string().optional().describe("Optional webhook signing secret"),
      },
  • Registration of the create_webhook tool via server.registerTool within the registerWebhookTools function.
    server.registerTool(
      "create_webhook",
      {
        description: "Create a new webhook to receive WhatsApp events at a URL",
        inputSchema: {
          sessionId: z.string().describe("Session ID"),
          url: z.string().describe("Webhook endpoint URL"),
          events: z.array(z.string()).describe("Array of event types to subscribe to"),
          secret: z.string().optional().describe("Optional webhook signing secret"),
        },
      },
      async ({ sessionId, url, events, secret }) => {
        const data = await openwaClient({
          method: "POST",
          path: `/sessions/${sessionId}/webhooks`,
          body: { url, events, secret },
        });
        return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] };
      }
    );
  • src/index.ts:9-20 (registration)
    Registration of the webhook tools module (including create_webhook) in the main server startup.
    import { registerWebhookTools } from "./tools/webhooks.js";
    import { registerLabelTools } from "./tools/labels.js";
    import { registerMediaTools } from "./tools/media.js";
    
    const server = new McpServer({ name: "openwa-mcp", version: "1.0.0" });
    
    registerSessionTools(server);
    registerMessageTools(server);
    registerBulkTools(server);
    registerGroupTools(server);
    registerContactTools(server);
    registerWebhookTools(server);
  • Helper HTTP client used by the create_webhook handler to make the POST request to the OpenWA API.
    export async function openwaClient<T = unknown>(opts: RequestOptions): Promise<T> {
      const url = `${BASE_URL}${opts.path}`;
    
      const headers: Record<string, string> = {
        "Content-Type": "application/json",
        "X-API-Key": API_KEY,
      };
    
      const res = await fetch(url, {
        method: opts.method,
        headers,
        body: opts.body ? JSON.stringify(opts.body) : undefined,
      });
    
      const text = await res.text();
    
      if (!res.ok) {
        throw new Error(`OpenWA API ${res.status}: ${text}`);
      }
    
      try {
        return JSON.parse(text) as T;
      } catch {
        return text as T;
      }
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must fully disclose behavior. It only states the basic creation action, omitting side effects, validation, permissions, or whether existing webhooks are overwritten.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence of 12 words, no filler, front-loaded with the core purpose. It is appropriately sized for its simplicity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Despite low complexity with no output schema or nested objects, the description does not explain what the tool returns or how to proceed after creation. It lacks information about webhook lifecycle, confirmation, or integration with sibling tools.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, so each parameter is already documented. The description adds minimal value, only implying that the url is the endpoint via 'at a URL', and does not elaborate on event types or the secret parameter's purpose beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states the tool creates a webhook to receive WhatsApp events at a URL. It uses a specific verb and resource, and the sibling tools like delete_webhook, update_webhook, and list_webhooks are clearly distinct.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives like update_webhook or list_webhooks. There is no mention of prerequisites, typical scenarios, or when not to use it.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ExoCubeYT/openwa-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server