'use client'; import { useState, useMemo } from 'react'; import { Webhook, Copy, Check } from 'lucide-react'; import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { Button } from '@/components/ui/button'; import { API_BASE_URL } from '@/lib/apiClient'; function getWebhookSnippet(): string { const baseUrl = API_BASE_URL.replace(/\/$/, ''); return `curl -X POST ${baseUrl}/api/v1/translate \\ -H "Authorization: Bearer sk_live_YOUR_API_KEY" \\ -H "Content-Type: multipart/form-data" \\ -F "file=@document.xlsx" \\ -F "source_lang=en" \\ -F "target_lang=fr" \\ -F "webhook_url=https://your-app.com/webhook/complete"`; } export function WebhookSnippet() { const [copied, setCopied] = useState(false); const webhookSnippet = useMemo(() => getWebhookSnippet(), []); const copySnippet = () => { navigator.clipboard.writeText(webhookSnippet); setCopied(true); setTimeout(() => setCopied(false), 2000); }; return (
Webhook Integration

Pass a webhook_url parameter to receive a POST request when your translation is complete.

            {webhookSnippet}
          
); }