Skip to main content
Glama

waha_get_contact_profile_picture

Retrieve a WhatsApp contact's profile picture URL using their contact ID. Specify whether to fetch a fresh image from the server or use cached data.

Instructions

Get contact's profile picture URL.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contactIdYesContact ID (format: number@c.us)
refreshNoRefresh from server (default: false)

Implementation Reference

  • src/index.ts:939-957 (registration)
    Tool registration in ListToolsRequestSchema handler, defines name, description, and input schema.
    { name: "waha_get_contact_profile_picture", description: "Get contact's profile picture URL.", inputSchema: { type: "object", properties: { contactId: { type: "string", description: "Contact ID (format: number@c.us)", }, refresh: { type: "boolean", description: "Refresh from server (default: false)", default: false, }, }, required: ["contactId"], }, },
  • MCP tool handler function that validates input, calls WAHA client method, and returns formatted URL response.
    private async handleGetContactProfilePicture(args: any) { const contactId = args.contactId; const refresh = args.refresh || false; if (!contactId) { throw new Error("contactId is required"); } const result = await this.wahaClient.getContactProfilePicture({ contactId, refresh, }); return { content: [ { type: "text", text: `Profile picture URL for ${contactId}:\n${result.url}\n${refresh ? '(Refreshed from server)' : '(From cache)'}`, }, ], }; }
  • WAHA client helper method that constructs API endpoint and makes HTTP GET request to retrieve contact profile picture URL.
    async getContactProfilePicture(params: { contactId: string; refresh?: boolean; }): Promise<{ url: string }> { const { contactId, refresh } = params; if (!contactId) { throw new WAHAError("contactId is required"); } const queryParams: Record<string, any> = { contactId, session: this.session }; if (refresh !== undefined) { queryParams.refresh = refresh; } const queryString = this.buildQueryString(queryParams); const endpoint = `/api/contacts/profile-picture${queryString}`; const response = await this.request<{ profilePictureURL?: string; url?: string }>(endpoint, { method: "GET", }); // Handle both response formats: profilePictureURL (contacts) or url (chats) return { url: response.profilePictureURL || response.url || '' }; }

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/seejux/waha-mcp'

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