Skip to main content
Glama

get_campaign_messages

Retrieve messages associated with a specific campaign using the campaign ID. This tool integrates with the Klaviyo MCP Server to access and manage marketing automation features efficiently.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
campaign_idYesID of the campaign to retrieve messages for

Implementation Reference

  • The handler function that fetches campaign messages for a given campaign_id using klaviyoClient.get and returns the JSON response or an error message.
    async (params) => { try { const messages = await klaviyoClient.get(`/campaigns/${params.campaign_id}/campaign-messages/`); return { content: [{ type: "text", text: JSON.stringify(messages, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error retrieving campaign messages: ${error.message}` }], isError: true }; } },
  • Input schema validating the campaign_id parameter as a string.
    { campaign_id: z.string().describe("ID of the campaign to retrieve messages for") },
  • Registers the get_campaign_messages tool with the MCP server, specifying name, input schema, handler function, and description.
    server.tool( "get_campaign_messages", { campaign_id: z.string().describe("ID of the campaign to retrieve messages for") }, async (params) => { try { const messages = await klaviyoClient.get(`/campaigns/${params.campaign_id}/campaign-messages/`); return { content: [{ type: "text", text: JSON.stringify(messages, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error retrieving campaign messages: ${error.message}` }], isError: true }; } }, { description: "Get all messages for a specific campaign" } );

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/ivan-rivera-projects/Klaviyo-MCP-Server-Enhanced'

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