🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@robinpath/whatsapp

Package Overview
Dependencies
Maintainers
4
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@robinpath/whatsapp - npm Package Compare versions

Comparing version
0.1.1
to
0.3.0
+6
dist/index.d.ts
import type { ModuleAdapter } from "@robinpath/core";
declare const WhatsappModule: ModuleAdapter;
export default WhatsappModule;
export { WhatsappModule };
export { WhatsappFunctions, WhatsappFunctionMetadata, WhatsappModuleMetadata, WhatsappCredentialTypes, } from "./whatsapp.js";
//# sourceMappingURL=index.d.ts.map
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AASrD,QAAA,MAAM,cAAc,EAAE,aAQrB,CAAC;AAEF,eAAe,cAAc,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,CAAC;AAC1B,OAAO,EACL,iBAAiB,EACjB,wBAAwB,EACxB,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,eAAe,CAAC"}
import { WhatsappFunctions, WhatsappFunctionMetadata, WhatsappModuleMetadata, WhatsappCredentialTypes, configureWhatsapp, } from "./whatsapp.js";
const WhatsappModule = {
name: "whatsapp",
functions: WhatsappFunctions,
functionMetadata: WhatsappFunctionMetadata,
moduleMetadata: WhatsappModuleMetadata,
credentialTypes: WhatsappCredentialTypes,
configure: configureWhatsapp,
global: false,
};
export default WhatsappModule;
export { WhatsappModule };
export { WhatsappFunctions, WhatsappFunctionMetadata, WhatsappModuleMetadata, WhatsappCredentialTypes, } from "./whatsapp.js";
//# sourceMappingURL=index.js.map
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,iBAAiB,EACjB,wBAAwB,EACxB,sBAAsB,EACtB,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,eAAe,CAAC;AAEvB,MAAM,cAAc,GAAkB;IACpC,IAAI,EAAE,UAAU;IAChB,SAAS,EAAE,iBAAiB;IAC5B,gBAAgB,EAAE,wBAAwB;IAC1C,cAAc,EAAE,sBAAsB;IACtC,eAAe,EAAE,uBAAuB;IACxC,SAAS,EAAE,iBAAiB;IAC5B,MAAM,EAAE,KAAK;CACd,CAAC;AAEF,eAAe,cAAc,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,CAAC;AAC1B,OAAO,EACL,iBAAiB,EACjB,wBAAwB,EACxB,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,eAAe,CAAC"}
/**
* RobinPath WhatsApp Module (Node port)
*
* Meta WhatsApp Business Cloud API (Graph v18.0) integration — send text,
* template, media and document messages through a Business phone number,
* mark inbound messages as read, and download media bodies. Mirrors the
* canonical adapter shape (Airtable/Shopify/GitHub) so the visual editor
* can render it identically to other credential-vault modules.
*
* Authentication uses the RobinPath credential vault. Every handler takes
* a credential slug as its first argument; the module resolves the stored
* `access_token` + `phone_number_id` at call time via the injected
* ModuleHost.
*
* Credential type declared by this module:
* - whatsapp : { access_token, phone_number_id, business_account_id? }
* → Bearer auth on graph.facebook.com
*/
import type { BuiltinHandler, CredentialTypeSchema, FunctionMetadata, ModuleHost, ModuleMetadata } from "@robinpath/core";
export declare function configureWhatsapp(h: ModuleHost): void;
export declare const WhatsappFunctions: Record<string, BuiltinHandler>;
export declare const WhatsappCredentialTypes: CredentialTypeSchema[];
export declare const WhatsappFunctionMetadata: Record<string, FunctionMetadata>;
export declare const WhatsappModuleMetadata: ModuleMetadata;
//# sourceMappingURL=whatsapp.d.ts.map
{"version":3,"file":"whatsapp.d.ts","sourceRoot":"","sources":["../src/whatsapp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,UAAU,EACV,cAAc,EAEf,MAAM,iBAAiB,CAAC;AAezB,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,UAAU,GAAG,IAAI,CAErD;AAwWD,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAO5D,CAAC;AAIF,eAAO,MAAM,uBAAuB,EAAE,oBAAoB,EAqCzD,CAAC;AAqDF,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAuQrE,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,cA6BpC,CAAC"}
/**
* RobinPath WhatsApp Module (Node port)
*
* Meta WhatsApp Business Cloud API (Graph v18.0) integration — send text,
* template, media and document messages through a Business phone number,
* mark inbound messages as read, and download media bodies. Mirrors the
* canonical adapter shape (Airtable/Shopify/GitHub) so the visual editor
* can render it identically to other credential-vault modules.
*
* Authentication uses the RobinPath credential vault. Every handler takes
* a credential slug as its first argument; the module resolves the stored
* `access_token` + `phone_number_id` at call time via the injected
* ModuleHost.
*
* Credential type declared by this module:
* - whatsapp : { access_token, phone_number_id, business_account_id? }
* → Bearer auth on graph.facebook.com
*/
// ── Module-local state (populated by configure hook) ────────────────────
const state = {};
function host() {
if (!state.host) {
throw new Error("WhatsApp module not initialized. Pass the adapter to rp.registerModule() via loadModule so its configure() hook runs first.");
}
return state.host;
}
export function configureWhatsapp(h) {
state.host = h;
}
// ── Constants ──────────────────────────────────────────────────────────
const API_BASE = "https://graph.facebook.com/v18.0/";
const CREDENTIAL_TYPE = "whatsapp";
function errorReturn(error, code, extra = {}) {
return { error, code, ...extra };
}
function isErr(x) {
return (typeof x === "object" &&
x !== null &&
"error" in x &&
"code" in x);
}
async function resolveCreds(credentialSlug) {
if (!credentialSlug) {
return errorReturn("Credential slug is required.", "credential_not_found");
}
let fields;
try {
fields = await host().credentials.get(credentialSlug);
}
catch (e) {
return errorReturn(e instanceof Error ? e.message : String(e), "credential_not_found");
}
if (!fields) {
return errorReturn(`Credential '${credentialSlug}' not found.`, "credential_not_found");
}
const token = String(fields.access_token ?? "");
const phoneNumberId = String(fields.phone_number_id ?? "");
const businessAccountId = String(fields.business_account_id ?? "");
if (!token) {
return errorReturn("Credential has no `access_token` field.", "access_token_missing");
}
if (!phoneNumberId) {
return errorReturn("Credential has no `phone_number_id` field.", "phone_number_id_missing");
}
return { token, phoneNumberId, businessAccountId };
}
// ── HTTP helper (normalized envelope, never throws for API errors) ─────
async function http(token, method, pathAndQuery, body) {
const init = {
method,
headers: {
Authorization: `Bearer ${token}`,
...(body !== undefined && body !== null
? { "Content-Type": "application/json" }
: {}),
},
};
if (body !== undefined && body !== null)
init.body = JSON.stringify(body);
let response;
try {
response = await fetch(API_BASE + pathAndQuery.replace(/^\/+/, ""), init);
}
catch (e) {
return errorReturn(e instanceof Error ? e.message : String(e), "transport");
}
const raw = await response.text();
let decoded;
try {
decoded = raw ? JSON.parse(raw) : null;
}
catch {
decoded = { raw };
}
if (response.status >= 200 && response.status < 300) {
return decoded ?? { ok: true };
}
// Graph errors look like: { error: { message, type, code, error_subcode, fbtrace_id } }
const errObj = decoded && typeof decoded === "object" && "error" in decoded
? decoded.error
: decoded;
let message = `WhatsApp returned HTTP ${response.status}.`;
if (errObj && typeof errObj === "object" && "message" in errObj) {
message = String(errObj.message);
}
else if (typeof errObj === "string") {
message = errObj;
}
let code = "whatsapp_error";
if (response.status === 429)
code = "rate_limited";
else if (response.status === 404)
code = "not_found";
else if (response.status === 401 || response.status === 403) {
code = "unauthorized";
}
return errorReturn(message, code, {
status: response.status,
whatsapp_error: decoded,
});
}
// ── Helpers ────────────────────────────────────────────────────────────
function asString(v) {
if (v === undefined || v === null)
return "";
return String(v);
}
function asOpts(v) {
return v && typeof v === "object" && !Array.isArray(v)
? v
: {};
}
/**
* Build a media sub-object. Accepts either `{id}` (already-uploaded media)
* or `{link}` (public URL). Attaches optional `caption` / `filename`.
*/
function buildMediaPayload(mediaIdOrUrl, opts) {
const out = {};
const isUrl = /^https?:\/\//i.test(mediaIdOrUrl);
if (isUrl) {
out.link = mediaIdOrUrl;
}
else {
out.id = mediaIdOrUrl;
}
if (opts.caption !== undefined && opts.caption !== null && opts.caption !== "") {
out.caption = String(opts.caption);
}
if (opts.filename !== undefined && opts.filename !== null && opts.filename !== "") {
out.filename = String(opts.filename);
}
return out;
}
// ── Handlers ───────────────────────────────────────────────────────────
const sendText = async (args) => {
const cred = asString(args[0]);
const to = asString(args[1]);
const message = asString(args[2]);
const opts = asOpts(args[3]);
if (!to)
return errorReturn("`to` is required.", "to_missing");
if (!message) {
return errorReturn("`message` is required.", "message_missing");
}
const resolved = await resolveCreds(cred);
if (isErr(resolved))
return resolved;
const text = { body: message };
if (opts.preview_url !== undefined) {
text.preview_url = Boolean(opts.preview_url);
}
return (await http(resolved.token, "POST", `${resolved.phoneNumberId}/messages`, {
messaging_product: "whatsapp",
recipient_type: "individual",
to,
type: "text",
text,
}));
};
const sendTemplate = async (args) => {
const cred = asString(args[0]);
const to = asString(args[1]);
const templateName = asString(args[2]);
const languageCode = args[3] !== undefined && args[3] !== null && args[3] !== ""
? asString(args[3])
: "en_US";
const components = args[4];
if (!to)
return errorReturn("`to` is required.", "to_missing");
if (!templateName) {
return errorReturn("`templateName` is required.", "template_name_missing");
}
const resolved = await resolveCreds(cred);
if (isErr(resolved))
return resolved;
const template = {
name: templateName,
language: { code: languageCode },
};
if (Array.isArray(components) && components.length > 0) {
template.components = components;
}
return (await http(resolved.token, "POST", `${resolved.phoneNumberId}/messages`, {
messaging_product: "whatsapp",
to,
type: "template",
template,
}));
};
/**
* Send an image/audio/video/sticker. `mediaKind` picks the message type —
* defaults to `image` when omitted. `mediaIdOrUrl` is either a media ID
* (from a prior upload) or an https:// public URL.
*/
const sendMedia = async (args) => {
const cred = asString(args[0]);
const to = asString(args[1]);
const mediaIdOrUrl = asString(args[2]);
const opts = asOpts(args[3]);
const mediaKind = opts.type !== undefined && opts.type !== null && opts.type !== ""
? String(opts.type).toLowerCase()
: "image";
if (!to)
return errorReturn("`to` is required.", "to_missing");
if (!mediaIdOrUrl) {
return errorReturn("`mediaIdOrUrl` is required.", "media_missing");
}
if (!["image", "audio", "video", "sticker"].includes(mediaKind)) {
return errorReturn("`type` must be one of: image, audio, video, sticker.", "invalid_media_type");
}
const resolved = await resolveCreds(cred);
if (isErr(resolved))
return resolved;
const body = {
messaging_product: "whatsapp",
recipient_type: "individual",
to,
type: mediaKind,
[mediaKind]: buildMediaPayload(mediaIdOrUrl, opts),
};
return (await http(resolved.token, "POST", `${resolved.phoneNumberId}/messages`, body));
};
const sendDocument = async (args) => {
const cred = asString(args[0]);
const to = asString(args[1]);
const documentIdOrUrl = asString(args[2]);
const opts = asOpts(args[3]);
if (!to)
return errorReturn("`to` is required.", "to_missing");
if (!documentIdOrUrl) {
return errorReturn("`documentIdOrUrl` is required.", "document_missing");
}
const resolved = await resolveCreds(cred);
if (isErr(resolved))
return resolved;
const document = buildMediaPayload(documentIdOrUrl, opts);
return (await http(resolved.token, "POST", `${resolved.phoneNumberId}/messages`, {
messaging_product: "whatsapp",
recipient_type: "individual",
to,
type: "document",
document,
}));
};
const markAsRead = async (args) => {
const cred = asString(args[0]);
const messageId = asString(args[1]);
if (!messageId) {
return errorReturn("`messageId` is required.", "message_id_missing");
}
const resolved = await resolveCreds(cred);
if (isErr(resolved))
return resolved;
return (await http(resolved.token, "POST", `${resolved.phoneNumberId}/messages`, {
messaging_product: "whatsapp",
status: "read",
message_id: messageId,
}));
};
/**
* Fetch media metadata by media ID. Returns `{url, mime_type, sha256, file_size, id, …}`.
* The `url` requires the same access token to actually download the bytes —
* script authors must call `http.get` with the `Authorization: Bearer …` header
* to retrieve the binary.
*/
const getMedia = async (args) => {
const cred = asString(args[0]);
const mediaId = asString(args[1]);
if (!mediaId) {
return errorReturn("`mediaId` is required.", "media_id_missing");
}
const resolved = await resolveCreds(cred);
if (isErr(resolved))
return resolved;
return (await http(resolved.token, "GET", encodeURIComponent(mediaId)));
};
// ── Exports: functions map ─────────────────────────────────────────────
export const WhatsappFunctions = {
sendText,
sendTemplate,
sendMedia,
sendDocument,
markAsRead,
getMedia,
};
// ── Exports: credential types ──────────────────────────────────────────
export const WhatsappCredentialTypes = [
{
slug: CREDENTIAL_TYPE,
title: "WhatsApp Business Cloud API",
icon: "message-circle",
fields: [
{
name: "access_token",
title: "Access Token",
type: "password",
required: true,
placeholder: "EAAB…",
description: "System user permanent access token with `whatsapp_business_messaging` + `whatsapp_business_management` scopes. Create at developers.facebook.com → Business settings → Users → System users.",
},
{
name: "phone_number_id",
title: "Phone Number ID",
type: "text",
required: true,
placeholder: "1234567890123456",
description: "Numeric ID of the WhatsApp Business phone number. Find it in Meta Business Suite → WhatsApp → API Setup.",
pattern: "^\\d+$",
},
{
name: "business_account_id",
title: "WhatsApp Business Account ID",
type: "text",
required: false,
placeholder: "9876543210987654",
description: "Optional. Only needed for management endpoints (template CRUD, account config). Not used by the message-sending handlers.",
pattern: "^\\d+$",
},
],
},
];
// ── Exports: metadata ──────────────────────────────────────────────────
const credentialParam = {
name: "credential",
title: "Credential",
description: "Slug of a saved `whatsapp` credential.",
dataType: "string",
formInputType: "resource",
required: true,
allowExpression: true,
placeholder: "my_whatsapp",
resource: {
type: "credential",
listFn: "credential.list",
modes: ["list", "expression"],
searchable: true,
filter: { type: CREDENTIAL_TYPE },
},
};
const toParam = {
name: "to",
title: "Recipient",
description: "Recipient phone number in E.164 format (no leading `+`, e.g. `14155552671`). Must already have opted in or received an approved template message.",
dataType: "string",
formInputType: "text",
required: true,
allowExpression: true,
placeholder: "14155552671",
};
const commonErrors = {
credential_not_found: "No credential with that slug exists in the vault.",
access_token_missing: "The credential exists but has no `access_token` field.",
phone_number_id_missing: "The credential exists but has no `phone_number_id` field.",
to_missing: "Recipient phone number is required.",
message_missing: "Message body is required.",
template_name_missing: "Template name is required.",
media_missing: "Media ID or public HTTPS URL is required.",
document_missing: "Document ID or public HTTPS URL is required.",
message_id_missing: "Message ID is required.",
media_id_missing: "Media ID is required.",
invalid_media_type: "`type` must be one of image, audio, video, sticker.",
transport: "Network failure calling graph.facebook.com.",
whatsapp_error: "WhatsApp returned an error — see `whatsapp_error.error`.",
rate_limited: "Graph rate limited the request.",
not_found: "Resource not found.",
unauthorized: "Access token rejected (401/403). Re-check scopes and expiry.",
};
export const WhatsappFunctionMetadata = {
sendText: {
title: "Send text message",
summary: "Send a plain-text WhatsApp message",
description: "Calls `POST /{phone_number_id}/messages` with `type: text`. The recipient must have messaged your business within the last 24 hours, or you must send an approved template first.",
group: "messages",
action: "write",
icon: "send",
capability: "manage_options",
sideEffects: ["makes_http_call", "sends_message"],
idempotent: false,
since: "1.0.0",
tags: ["whatsapp", "message", "text"],
parameters: [
credentialParam,
toParam,
{
name: "message",
title: "Message",
description: "Message body (max 4096 chars).",
dataType: "string",
formInputType: "textarea",
required: true,
allowExpression: true,
rows: 4,
placeholder: "Hello from RobinPath!",
},
{
name: "options",
title: "Options",
description: "Recognized keys:\n preview_url : bool — render a link preview for the first URL in the body",
dataType: "object",
formInputType: "json",
required: false,
allowExpression: true,
language: "json",
rows: 3,
advanced: true,
},
],
returnType: "object",
returnDescription: "{ messaging_product: 'whatsapp', contacts: [{wa_id}], messages: [{id}] }",
errors: commonErrors,
example: 'whatsapp.sendText "my_whatsapp" "14155552671" "Hello from RobinPath!"',
},
sendTemplate: {
title: "Send template message",
summary: "Send a pre-approved template (the only way to start a conversation)",
description: "Calls `POST /{phone_number_id}/messages` with `type: template`. Template must be approved in Meta Business Manager first. Use this to initiate conversations outside the 24-hour customer service window.",
group: "messages",
action: "write",
icon: "file-text",
capability: "manage_options",
sideEffects: ["makes_http_call", "sends_message"],
idempotent: false,
since: "1.0.0",
tags: ["whatsapp", "template", "message"],
parameters: [
credentialParam,
toParam,
{
name: "templateName",
title: "Template name",
description: "Name of the approved template (e.g. `hello_world`, `order_confirmation`).",
dataType: "string",
formInputType: "text",
required: true,
allowExpression: true,
placeholder: "hello_world",
},
{
name: "languageCode",
title: "Language code",
description: "BCP-47 language tag (default `en_US`).",
dataType: "string",
formInputType: "text",
required: false,
allowExpression: true,
placeholder: "en_US",
},
{
name: "components",
title: "Components",
description: "Array of component objects (header/body/button). Pass `null`/omit for a zero-variable template.\n\nExample:\n [{\n type: 'body',\n parameters: [{type: 'text', text: 'Ada'}]\n }]",
dataType: "array",
formInputType: "json",
required: false,
allowExpression: true,
language: "json",
rows: 6,
advanced: true,
},
],
returnType: "object",
errors: commonErrors,
example: 'whatsapp.sendTemplate "my_whatsapp" "14155552671" "hello_world" "en_US"',
},
sendMedia: {
title: "Send media message",
summary: "Send an image, audio, video, or sticker",
description: "Calls `POST /{phone_number_id}/messages`. Pass either a **media ID** (returned from a prior upload) or a **public HTTPS URL** — the module auto-detects by `^https?://` prefix.\n\nUse the `type` option to pick the message kind (default `image`).",
group: "messages",
action: "write",
icon: "image",
capability: "manage_options",
sideEffects: ["makes_http_call", "sends_message"],
idempotent: false,
since: "1.0.0",
tags: ["whatsapp", "media", "image", "video", "audio", "sticker"],
parameters: [
credentialParam,
toParam,
{
name: "mediaIdOrUrl",
title: "Media ID or URL",
description: "Either a Graph media ID (from a prior `POST /{phone_number_id}/media` upload) or a public `https://…` URL that Meta can fetch.",
dataType: "string",
formInputType: "text",
required: true,
allowExpression: true,
placeholder: "https://example.com/photo.jpg",
},
{
name: "options",
title: "Options",
description: "Recognized keys:\n type : 'image' (default) | 'audio' | 'video' | 'sticker'\n caption : string — optional caption (image/video only)",
dataType: "object",
formInputType: "json",
required: false,
allowExpression: true,
language: "json",
rows: 3,
},
],
returnType: "object",
errors: commonErrors,
example: 'whatsapp.sendMedia "my_whatsapp" "14155552671" "https://example.com/photo.jpg" {type: "image", caption: "Check this out"}',
},
sendDocument: {
title: "Send document message",
summary: "Send a PDF/DOCX/XLSX/etc. attachment",
description: "Calls `POST /{phone_number_id}/messages` with `type: document`. Pass a media ID or HTTPS URL; optionally supply `filename` and `caption`.",
group: "messages",
action: "write",
icon: "file",
capability: "manage_options",
sideEffects: ["makes_http_call", "sends_message"],
idempotent: false,
since: "1.0.0",
tags: ["whatsapp", "document", "pdf"],
parameters: [
credentialParam,
toParam,
{
name: "documentIdOrUrl",
title: "Document ID or URL",
description: "Either a Graph media ID or a public `https://…` URL pointing at the document.",
dataType: "string",
formInputType: "text",
required: true,
allowExpression: true,
placeholder: "https://example.com/report.pdf",
},
{
name: "options",
title: "Options",
description: "Recognized keys:\n filename : string — display name in the chat\n caption : string — optional caption",
dataType: "object",
formInputType: "json",
required: false,
allowExpression: true,
language: "json",
rows: 3,
},
],
returnType: "object",
errors: commonErrors,
example: 'whatsapp.sendDocument "my_whatsapp" "14155552671" "https://example.com/report.pdf" {filename: "report.pdf"}',
},
markAsRead: {
title: "Mark message as read",
summary: "Send a read receipt for an inbound message",
description: "Calls `POST /{phone_number_id}/messages` with `status: read` and the inbound `message_id`. Shows blue ticks to the sender.",
group: "messages",
action: "write",
icon: "check-check",
capability: "manage_options",
sideEffects: ["makes_http_call"],
idempotent: true,
since: "1.0.0",
tags: ["whatsapp", "read", "status"],
parameters: [
credentialParam,
{
name: "messageId",
title: "Message ID",
description: "Inbound message ID (`wamid.…`) from the webhook payload.",
dataType: "string",
formInputType: "text",
required: true,
allowExpression: true,
placeholder: "wamid.HBgLMTQxNTU1NTI2NzEVAgARGBIyQUYz…",
},
],
returnType: "object",
returnDescription: "{ success: true }",
errors: commonErrors,
example: 'whatsapp.markAsRead "my_whatsapp" "wamid.HBgLMTQxNTU1NTI2NzEV…"',
},
getMedia: {
title: "Get media metadata",
summary: "Resolve a media ID to a short-lived download URL",
description: "Calls `GET /{media_id}`. Returns `{url, mime_type, sha256, file_size, id, messaging_product}`. The `url` is short-lived (~5 minutes) and requires the same Bearer token to download — chain with `http.get` and pass the token in an Authorization header.",
group: "media",
action: "read",
icon: "download",
capability: "manage_options",
sideEffects: ["makes_http_call"],
idempotent: true,
since: "1.0.0",
tags: ["whatsapp", "media", "download"],
parameters: [
credentialParam,
{
name: "mediaId",
title: "Media ID",
description: "Media ID from an inbound message (webhook) or from a prior upload.",
dataType: "string",
formInputType: "text",
required: true,
allowExpression: true,
placeholder: "1234567890123456",
},
],
returnType: "object",
returnDescription: "{ url, mime_type, sha256, file_size, id, messaging_product }",
errors: commonErrors,
example: 'whatsapp.getMedia "my_whatsapp" "1234567890123456"',
},
};
export const WhatsappModuleMetadata = {
slug: "whatsapp",
title: "WhatsApp",
summary: "Send WhatsApp messages, templates, media and documents via the Meta Cloud API",
description: "WhatsApp Business Cloud API (Graph v18.0) — send text, template, media and document messages from your Business phone number, mark inbound messages as read, and resolve media IDs to download URLs.\n\nAuth is a **permanent system-user access token** plus the **phone number ID** you want to send from; store them together as a `whatsapp` credential. Inbound messages arrive via webhook — wire `POST /wp-json/robinpath-wp/v1/webhook/whatsapp` (or the desktop equivalent) to your Meta app's webhook URL and the `messages` field will trigger.",
category: "messaging",
icon: "icon.svg",
color: "#25D366",
version: "0.2.0",
docsUrl: "https://docs.robinpath.com/modules/whatsapp",
status: "stable",
requires: [],
minNodeVersion: "18.0.0",
credentialsType: CREDENTIAL_TYPE,
operationGroups: {
messages: {
title: "Messages",
description: "Outbound text, template, media, document and read receipts.",
order: 1,
},
media: {
title: "Media",
description: "Resolve and download media IDs.",
order: 2,
},
},
methods: Object.keys(WhatsappFunctions),
};
//# sourceMappingURL=whatsapp.js.map
{"version":3,"file":"whatsapp.js","sourceRoot":"","sources":["../src/whatsapp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAWH,2EAA2E;AAE3E,MAAM,KAAK,GAA0B,EAAE,CAAC;AAExC,SAAS,IAAI;IACX,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CACb,6HAA6H,CAC9H,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC;AACpB,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,CAAa;IAC7C,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC;AACjB,CAAC;AAED,0EAA0E;AAE1E,MA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AAE,IAAI;gBACd,eAAe,EAAE,IAAI;gBACrB,WAAW,EAAE,kBAAkB;aAChC;SACF;QACD,UAAU,EAAE,QAAQ;QACpB,iBAAiB,EAAE,8DAA8D;QACjF,MAAM,EAAE,YAAY;QACpB,OAAO,EAAE,oDAAoD;KAC9D;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAmB;IACpD,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,UAAU;IACjB,OAAO,EACL,+EAA+E;IACjF,WAAW,EACT,4hBAA4hB;IAC9hB,QAAQ,EAAE,WAAW;IACrB,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,SAAS;IAChB,OAAO,EAAE,OAAO;IAChB,OAAO,EAAE,6CAA6C;IACtD,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,EAAE;IACZ,cAAc,EAAE,QAAQ;IACxB,eAAe,EAAE,eAAe;IAChC,eAAe,EAAE;QACf,QAAQ,EAAE;YACR,KAAK,EAAE,UAAU;YACjB,WAAW,EAAE,6DAA6D;YAC1E,KAAK,EAAE,CAAC;SACT;QACD,KAAK,EAAE;YACL,KAAK,EAAE,OAAO;YACd,WAAW,EAAE,iCAAiC;YAC9C,KAAK,EAAE,CAAC;SACT;KACF;IACD,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC;CACxC,CAAC"}
+15
-8
{
"name": "@robinpath/whatsapp",
"version": "0.1.1",
"version": "0.3.0",
"publishConfig": {

@@ -23,9 +23,9 @@ "access": "public"

"peerDependencies": {
"@robinpath/core": ">=0.20.0"
"@robinpath/core": ">=0.40.0"
},
"devDependencies": {
"@robinpath/core": "^0.30.1",
"@robinpath/core": "^0.40.0",
"typescript": "^5.6.0"
},
"description": "WhatsApp module for RobinPath.",
"description": "Meta WhatsApp Business Cloud API — send text, template, media and document messages, mark messages as read, and resolve media IDs. Uses the encrypted credential vault.",
"keywords": [

@@ -38,7 +38,14 @@ "whatsapp",

"category": "messaging",
"type": "integration",
"auth": "api-key",
"functionCount": 10,
"baseUrl": "https://graph.facebook.com"
"type": "module",
"auth": "credential-vault",
"credentialType": "whatsapp",
"functionCount": 6,
"baseUrl": "https://graph.facebook.com/v18.0",
"language": "nodejs",
"platforms": [
"cloud",
"cli",
"desktop"
]
}
}

@@ -22,3 +22,3 @@ # @robinpath/whatsapp

```bash
npm install @robinpath/whatsapp
robinpath add @robinpath/whatsapp
```

@@ -25,0 +25,0 @@