Skip to main content
Glama

buddypress_create_message

Send private messages to multiple users on a BuddyPress community site by specifying recipients, subject, and message content.

Instructions

Create a new message

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
messageYesMessage content
recipientsYesArray of recipient user IDs
sender_idNoSender user ID (default: current user)
subjectYesMessage subject

Implementation Reference

  • Handler function that executes the buddypress_create_message tool by making a POST request to the BuddyPress /messages endpoint using the provided arguments.
    else if (name === 'buddypress_create_message') { result = await buddypressRequest('/messages', 'POST', args); }
  • Input schema definition for the buddypress_create_message tool, specifying parameters like recipients, subject, and message.
    inputSchema: { type: 'object', properties: { sender_id: { type: 'number', description: 'Sender user ID (default: current user)' }, recipients: { type: 'array', items: { type: 'number' }, description: 'Array of recipient user IDs', required: true }, subject: { type: 'string', description: 'Message subject', required: true }, message: { type: 'string', description: 'Message content', required: true }, }, required: ['recipients', 'subject', 'message'], },
  • src/index.ts:428-441 (registration)
    Registration of the buddypress_create_message tool in the tools array, including name, description, and input schema.
    { name: 'buddypress_create_message', description: 'Create a new message', inputSchema: { type: 'object', properties: { sender_id: { type: 'number', description: 'Sender user ID (default: current user)' }, recipients: { type: 'array', items: { type: 'number' }, description: 'Array of recipient user IDs', required: true }, subject: { type: 'string', description: 'Message subject', required: true }, message: { type: 'string', description: 'Message content', required: true }, }, required: ['recipients', 'subject', 'message'], }, },
  • Shared helper utility that makes authenticated HTTP requests to the BuddyPress REST API, used by all tools including buddypress_create_message.
    async function buddypressRequest( endpoint: string, method: string = 'GET', body?: any ): Promise<any> { const url = `${BUDDYPRESS_URL}/wp-json/buddypress/v2${endpoint}`; const auth = Buffer.from(`${BUDDYPRESS_USERNAME}:${BUDDYPRESS_PASSWORD}`).toString('base64'); const options: any = { method, headers: { 'Authorization': `Basic ${auth}`, 'Content-Type': 'application/json', }, }; if (body && method !== 'GET') { options.body = JSON.stringify(body); } const response = await fetch(url, options); if (!response.ok) { const errorText = await response.text(); throw new Error(`BuddyPress API Error (${response.status}): ${errorText}`); } return await response.json(); }

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/vapvarun/buddypress-mcp'

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