Skip to main content
Glama
webhook.ts1.09 kB
import { AxiosRequestConfig } from "axios"; import { callAxios } from "../tools/strategies/http/http.js"; import { logMessage } from "./logs.js"; import { ServiceMetadata } from "../graphql/types.js"; interface WebhookPayload { runId: string; success: boolean; data?: any; error?: string; } // Handle webhook notification export async function notifyWebhook(webhookUrl: string, runId: string, success: boolean, data?: any, error?: string, metadata?: ServiceMetadata) { try { const webhookPayload: WebhookPayload = { runId, success, ...(data && { data }), ...(error && { error }) }; const axiosConfig: AxiosRequestConfig = { method: 'POST', url: webhookUrl, headers: { 'Content-Type': 'application/json' }, data: JSON.stringify(webhookPayload) }; await callAxios(axiosConfig, { timeout: 10000, retries: 3, retryDelay: 10000 }); } catch (error) { logMessage('error', `Webhook notification failed: ${error}`, metadata); // Don't throw, webhook failures shouldn't affect main operation } }

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/superglue-ai/superglue'

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