whatsapp_send
Send WhatsApp messages using pre-approved templates to phone numbers with country codes. Configure language and parameters for automated communication.
Instructions
Send a WhatsApp message using a pre-approved template ($0.005)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | Yes | Phone number with country code (e.g. +15551234567) | |
| template | Yes | ||
| language | No | en_US | |
| params | No |
Implementation Reference
- index.js:50-79 (handler)The 'callTool' function is the universal handler that executes the tool logic by fetching the defined endpoint from the IteraTools API.
async function callTool(endpoint, params) { const fetch = (await import('node-fetch')).default; const isGet = ['GET'].includes((TOOLS.find(t => t.endpoint === endpoint) || {}).method); const url = isGet ? `${BASE_URL}${endpoint}?${new URLSearchParams(params)}` : `${BASE_URL}${endpoint}`; const res = await fetch(url, { method: isGet ? 'GET' : 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${API_KEY}`, }, body: isGet ? undefined : JSON.stringify(params), }); const text = await res.text(); let data; try { data = JSON.parse(text); } catch { data = { raw: text }; } if (!res.ok) { if (res.status === 402) { throw new Error(`Insufficient credits. Add credits at https://iteratools.com. Cost: ${TOOLS.find(t=>t.endpoint===endpoint)?.price || 'see docs'}`); } throw new Error(`API error ${res.status}: ${text.substring(0, 200)}`); } return data; } - index.js:47-47 (schema)The 'whatsapp_send' tool definition including its inputSchema and endpoint mapping.
{ name: 'whatsapp_send', description: 'Send a WhatsApp message using a pre-approved template', inputSchema: { type: 'object', properties: { to: { type: 'string', description: 'Phone number with country code (e.g. +15551234567)' }, template: { type: 'string' }, language: { type: 'string', default: 'en_US' }, params: { type: 'array', items: { type: 'string' } } }, required: ['to', 'template'] }, endpoint: '/whatsapp/send', price: '$0.005' },