Skip to main content
Glama

Postman MCP Generator

by ramborau
send-sticker-message-by-url.js2.63 kB
/** * Function to send a sticker message via WhatsApp API. * * @param {Object} args - Arguments for sending the sticker message. * @param {string} args.recipientPhoneNumber - The recipient's phone number. * @param {string} args.stickerUrl - The URL of the sticker to send. * @param {string} [args.version] - The API version to use. * @param {string} [args.businessPhoneNumberId] - The business phone number ID. * @returns {Promise<Object>} - The result of the message sending operation. */ const executeFunction = async ({ recipientPhoneNumber, stickerUrl, version = '', businessPhoneNumberId = '' }) => { const baseUrl = '<API_URL>'; // will be provided by the user const token = process.env.BOTPE_MCP_API_KEY; try { const url = `${baseUrl}/${version}/${businessPhoneNumberId}/messages`; const body = { messaging_product: "whatsapp", recipient_type: "individual", to: recipientPhoneNumber, type: "sticker", sticker: { link: stickerUrl } }; const response = await fetch(url, { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${token}` }, body: JSON.stringify(body) }); if (!response.ok) { const errorData = await response.json(); throw new Error(JSON.stringify(errorData)); } const data = await response.json(); return data; } catch (error) { console.error('Error sending sticker message:', error); return { error: `An error occurred while sending the sticker message: ${error instanceof Error ? error.message : JSON.stringify(error)}` }; } }; /** * Tool configuration for sending sticker messages via WhatsApp API. * @type {Object} */ const apiTool = { function: executeFunction, definition: { type: 'function', function: { name: 'send_sticker_message', description: 'Send a sticker message via WhatsApp.', parameters: { type: 'object', properties: { recipientPhoneNumber: { type: 'string', description: 'The recipient\'s phone number.' }, stickerUrl: { type: 'string', description: 'The URL of the sticker to send.' }, version: { type: 'string', description: 'The API version to use.' }, businessPhoneNumberId: { type: 'string', description: 'The business phone number ID.' } }, required: ['recipientPhoneNumber', 'stickerUrl'] } } } }; export { apiTool };

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/ramborau/botpe-mcp-2'

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