Skip to main content
Glama
test-api.ts1.57 kB
import { execSync } from "child_process"; async function getApiKey(): Promise<string> { // First try environment variable const envKey = process.env.BUTTONDOWN_API_KEY; if (envKey) { return envKey; } // Fallback to 1Password try { const opKey = execSync( 'op read "op://Development/gg2r4na7nfbejolar3rgzgn7pa/notesPlain"', { encoding: "utf-8", } ).trim(); if (opKey) { return opKey; } } catch (error) { console.error( "Failed to read from 1Password:", error instanceof Error ? error.message : "Unknown error" ); } throw new Error( "Could not find Buttondown API key in environment or 1Password" ); } async function testButtondownApi() { try { const apiKey = await getApiKey(); console.log("Making API request..."); const response = await fetch("https://api.buttondown.email/v1/emails", { headers: { Authorization: `Token ${apiKey}`, "Content-Type": "application/json", }, }); if (!response.ok) { console.error( "API request failed:", response.status, response.statusText ); const errorText = await response.text(); console.error("Error details:", errorText); process.exit(1); } const data = await response.json(); console.log("API Response:", JSON.stringify(data, null, 2)); } catch (error) { console.error( "Error:", error instanceof Error ? error.message : "Unknown error" ); process.exit(1); } } testButtondownApi();

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/The-Focus-AI/buttondown-mcp'

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