feat(i18n): update translations (#1660)

This commit is contained in:
Waleed
2025-10-16 15:31:10 -07:00
committed by GitHub
parent 67e681dd7c
commit 74576ec921
6 changed files with 1061 additions and 5 deletions

View File

@@ -23,7 +23,210 @@ import { BlockInfoCard } from "@/components/ui/block-info-card"
</svg>`}
/>
## Übersicht
Der Generic Webhook-Block ermöglicht es Ihnen, Webhooks von jedem externen Dienst zu empfangen. Dies ist ein flexibler Auslöser, der jede JSON-Nutzlast verarbeiten kann und sich daher ideal für die Integration mit Diensten eignet, die keinen dedizierten Sim-Block haben.
## Grundlegende Verwendung
### Einfacher Durchleitungsmodus
Ohne ein Eingabeformat zu definieren, leitet der Webhook den gesamten Anforderungstext unverändert weiter:
```bash
curl -X POST https://sim.ai/api/webhooks/trigger/{webhook-path} \
-H "Content-Type: application/json" \
-H "X-Sim-Secret: your-secret" \
-d '{
"message": "Test webhook trigger",
"data": {
"key": "value"
}
}'
```
Greifen Sie in nachgelagerten Blöcken auf die Daten zu mit:
- `<webhook1.message>` → "Test webhook trigger"
- `<webhook1.data.key>` → "value"
### Strukturiertes Eingabeformat (Optional)
Definieren Sie ein Eingabeschema, um typisierte Felder zu erhalten und erweiterte Funktionen wie Datei-Uploads zu aktivieren:
**Konfiguration des Eingabeformats:**
```json
[
{ "name": "message", "type": "string" },
{ "name": "priority", "type": "number" },
{ "name": "documents", "type": "files" }
]
```
**Webhook-Anfrage:**
```bash
curl -X POST https://sim.ai/api/webhooks/trigger/{webhook-path} \
-H "Content-Type: application/json" \
-H "X-Sim-Secret: your-secret" \
-d '{
"message": "Invoice submission",
"priority": 1,
"documents": [
{
"type": "file",
"data": "data:application/pdf;base64,JVBERi0xLjQK...",
"name": "invoice.pdf",
"mime": "application/pdf"
}
]
}'
```
## Datei-Uploads
### Unterstützte Dateiformate
Der Webhook unterstützt zwei Dateieingabeformate:
#### 1. Base64-kodierte Dateien
Zum direkten Hochladen von Dateiinhalten:
```json
{
"documents": [
{
"type": "file",
"data": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgA...",
"name": "screenshot.png",
"mime": "image/png"
}
]
}
```
- **Maximale Größe**: 20MB pro Datei
- **Format**: Standard-Daten-URL mit Base64-Kodierung
- **Speicherung**: Dateien werden in sicheren Ausführungsspeicher hochgeladen
#### 2. URL-Referenzen
Zum Übergeben vorhandener Datei-URLs:
```json
{
"documents": [
{
"type": "url",
"data": "https://example.com/files/document.pdf",
"name": "document.pdf",
"mime": "application/pdf"
}
]
}
```
### Zugriff auf Dateien in nachgelagerten Blöcken
Dateien werden in `UserFile`Objekte mit folgenden Eigenschaften verarbeitet:
```typescript
{
id: string, // Unique file identifier
name: string, // Original filename
url: string, // Presigned URL (valid for 5 minutes)
size: number, // File size in bytes
type: string, // MIME type
key: string, // Storage key
uploadedAt: string, // ISO timestamp
expiresAt: string // ISO timestamp (5 minutes)
}
```
**Zugriff in Blöcken:**
- `<webhook1.documents[0].url>` → Download-URL
- `<webhook1.documents[0].name>` → "invoice.pdf"
- `<webhook1.documents[0].size>` → 524288
- `<webhook1.documents[0].type>` → "application/pdf"
### Vollständiges Beispiel für Datei-Upload
```bash
# Create a base64-encoded file
echo "Hello World" | base64
# SGVsbG8gV29ybGQK
# Send webhook with file
curl -X POST https://sim.ai/api/webhooks/trigger/{webhook-path} \
-H "Content-Type: application/json" \
-H "X-Sim-Secret: your-secret" \
-d '{
"subject": "Document for review",
"attachments": [
{
"type": "file",
"data": "data:text/plain;base64,SGVsbG8gV29ybGQK",
"name": "sample.txt",
"mime": "text/plain"
}
]
}'
```
## Authentifizierung
### Authentifizierung konfigurieren (optional)
In der Webhook-Konfiguration:
1. Aktiviere "Authentifizierung erforderlich"
2. Setze einen geheimen Token
3. Wähle den Header-Typ:
- **Benutzerdefinierter Header**: `X-Sim-Secret: your-token`
- **Authorization Bearer**: `Authorization: Bearer your-token`
### Verwendung der Authentifizierung
```bash
# With custom header
curl -X POST https://sim.ai/api/webhooks/trigger/{webhook-path} \
-H "Content-Type: application/json" \
-H "X-Sim-Secret: your-secret-token" \
-d '{"message": "Authenticated request"}'
# With bearer token
curl -X POST https://sim.ai/api/webhooks/trigger/{webhook-path} \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-secret-token" \
-d '{"message": "Authenticated request"}'
```
## Best Practices
1. **Eingabeformat für Struktur verwenden**: Definiere ein Eingabeformat, wenn du das erwartete Schema kennst. Dies bietet:
- Typvalidierung
- Bessere Autovervollständigung im Editor
- Datei-Upload-Funktionen
2. **Authentifizierung**: Aktiviere immer die Authentifizierung für Produktions-Webhooks, um unbefugten Zugriff zu verhindern.
3. **Dateigrößenbeschränkungen**: Halte Dateien unter 20 MB. Verwende für größere Dateien stattdessen URL-Referenzen.
4. **Dateiablauf**: Heruntergeladene Dateien haben URLs mit einer Gültigkeit von 5 Minuten. Verarbeite sie umgehend oder speichere sie an anderer Stelle, wenn sie länger benötigt werden.
5. **Fehlerbehandlung**: Die Webhook-Verarbeitung erfolgt asynchron. Überprüfe die Ausführungsprotokolle auf Fehler.
6. **Testen**: Verwende die Schaltfläche "Webhook testen" im Editor, um deine Konfiguration vor der Bereitstellung zu validieren.
## Anwendungsfälle
- **Formularübermittlungen**: Empfange Daten von benutzerdefinierten Formularen mit Datei-Uploads
- **Drittanbieter-Integrationen**: Verbinde mit Diensten, die Webhooks senden (Stripe, GitHub usw.)
- **Dokumentenverarbeitung**: Akzeptiere Dokumente von externen Systemen zur Verarbeitung
- **Ereignisbenachrichtigungen**: Empfange Ereignisdaten aus verschiedenen Quellen
- **Benutzerdefinierte APIs**: Erstelle benutzerdefinierte API-Endpunkte für deine Anwendungen
## Hinweise
- Kategorie: `triggers`
- Typ: `generic_webhook`
- **Dateiunterstützung**: Verfügbar über Eingabeformat-Konfiguration
- **Maximale Dateigröße**: 20 MB pro Datei

View File

@@ -22,7 +22,210 @@ import { BlockInfoCard } from "@/components/ui/block-info-card"
</svg>`}
/>
## Descripción general
El bloque de Webhook Genérico te permite recibir webhooks desde cualquier servicio externo. Este es un disparador flexible que puede manejar cualquier carga útil JSON, lo que lo hace ideal para integrarse con servicios que no tienen un bloque Sim dedicado.
## Uso básico
### Modo de paso simple
Sin definir un formato de entrada, el webhook transmite todo el cuerpo de la solicitud tal como está:
```bash
curl -X POST https://sim.ai/api/webhooks/trigger/{webhook-path} \
-H "Content-Type: application/json" \
-H "X-Sim-Secret: your-secret" \
-d '{
"message": "Test webhook trigger",
"data": {
"key": "value"
}
}'
```
Accede a los datos en bloques posteriores usando:
- `<webhook1.message>` → "Test webhook trigger"
- `<webhook1.data.key>` → "value"
### Formato de entrada estructurado (opcional)
Define un esquema de entrada para obtener campos tipados y habilitar funciones avanzadas como cargas de archivos:
**Configuración del formato de entrada:**
```json
[
{ "name": "message", "type": "string" },
{ "name": "priority", "type": "number" },
{ "name": "documents", "type": "files" }
]
```
**Solicitud de webhook:**
```bash
curl -X POST https://sim.ai/api/webhooks/trigger/{webhook-path} \
-H "Content-Type: application/json" \
-H "X-Sim-Secret: your-secret" \
-d '{
"message": "Invoice submission",
"priority": 1,
"documents": [
{
"type": "file",
"data": "data:application/pdf;base64,JVBERi0xLjQK...",
"name": "invoice.pdf",
"mime": "application/pdf"
}
]
}'
```
## Cargas de archivos
### Formatos de archivo compatibles
El webhook admite dos formatos de entrada de archivos:
#### 1. Archivos codificados en Base64
Para cargar contenido de archivos directamente:
```json
{
"documents": [
{
"type": "file",
"data": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgA...",
"name": "screenshot.png",
"mime": "image/png"
}
]
}
```
- **Tamaño máximo**: 20MB por archivo
- **Formato**: URL de datos estándar con codificación base64
- **Almacenamiento**: Los archivos se cargan en un almacenamiento de ejecución seguro
#### 2. Referencias URL
Para pasar URLs de archivos existentes:
```json
{
"documents": [
{
"type": "url",
"data": "https://example.com/files/document.pdf",
"name": "document.pdf",
"mime": "application/pdf"
}
]
}
```
### Acceso a archivos en bloques posteriores
Los archivos se procesan en objetos `UserFile` con las siguientes propiedades:
```typescript
{
id: string, // Unique file identifier
name: string, // Original filename
url: string, // Presigned URL (valid for 5 minutes)
size: number, // File size in bytes
type: string, // MIME type
key: string, // Storage key
uploadedAt: string, // ISO timestamp
expiresAt: string // ISO timestamp (5 minutes)
}
```
**Acceso en bloques:**
- `<webhook1.documents[0].url>` → URL de descarga
- `<webhook1.documents[0].name>` → "invoice.pdf"
- `<webhook1.documents[0].size>` → 524288
- `<webhook1.documents[0].type>` → "application/pdf"
### Ejemplo completo de carga de archivos
```bash
# Create a base64-encoded file
echo "Hello World" | base64
# SGVsbG8gV29ybGQK
# Send webhook with file
curl -X POST https://sim.ai/api/webhooks/trigger/{webhook-path} \
-H "Content-Type: application/json" \
-H "X-Sim-Secret: your-secret" \
-d '{
"subject": "Document for review",
"attachments": [
{
"type": "file",
"data": "data:text/plain;base64,SGVsbG8gV29ybGQK",
"name": "sample.txt",
"mime": "text/plain"
}
]
}'
```
## Autenticación
### Configurar autenticación (opcional)
En la configuración del webhook:
1. Habilita "Requerir autenticación"
2. Establece un token secreto
3. Elige el tipo de encabezado:
- **Encabezado personalizado**: `X-Sim-Secret: your-token`
- **Autorización Bearer**: `Authorization: Bearer your-token`
### Uso de la autenticación
```bash
# With custom header
curl -X POST https://sim.ai/api/webhooks/trigger/{webhook-path} \
-H "Content-Type: application/json" \
-H "X-Sim-Secret: your-secret-token" \
-d '{"message": "Authenticated request"}'
# With bearer token
curl -X POST https://sim.ai/api/webhooks/trigger/{webhook-path} \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-secret-token" \
-d '{"message": "Authenticated request"}'
```
## Mejores prácticas
1. **Usa formato de entrada para la estructura**: define un formato de entrada cuando conozcas el esquema esperado. Esto proporciona:
- Validación de tipo
- Mejor autocompletado en el editor
- Capacidades de carga de archivos
2. **Autenticación**: habilita siempre la autenticación para webhooks en producción para prevenir accesos no autorizados.
3. **Límites de tamaño de archivo**: mantén los archivos por debajo de 20MB. Para archivos más grandes, usa referencias URL en su lugar.
4. **Caducidad de archivos**: los archivos descargados tienen URLs con caducidad de 5 minutos. Procésalos rápidamente o almacénalos en otro lugar si los necesitas por más tiempo.
5. **Manejo de errores**: el procesamiento de webhooks es asíncrono. Revisa los registros de ejecución para ver errores.
6. **Pruebas**: usa el botón "Probar webhook" en el editor para validar tu configuración antes de implementarla.
## Casos de uso
- **Envíos de formularios**: recibe datos de formularios personalizados con cargas de archivos
- **Integraciones con terceros**: conéctate con servicios que envían webhooks (Stripe, GitHub, etc.)
- **Procesamiento de documentos**: acepta documentos de sistemas externos para procesamiento
- **Notificaciones de eventos**: recibe datos de eventos de varias fuentes
- **APIs personalizadas**: construye endpoints de API personalizados para tus aplicaciones
## Notas
- Categoría: `triggers`
- Tipo: `generic_webhook`
- **Soporte de archivos**: disponible a través de la configuración del formato de entrada
- **Tamaño máximo de archivo**: 20MB por archivo

View File

@@ -23,7 +23,210 @@ import { BlockInfoCard } from "@/components/ui/block-info-card"
</svg>`}
/>
## Notes
## Aperçu
Le bloc Webhook générique vous permet de recevoir des webhooks depuis n'importe quel service externe. C'est un déclencheur flexible qui peut traiter n'importe quelle charge utile JSON, ce qui le rend idéal pour l'intégration avec des services qui n'ont pas de bloc Sim dédié.
## Utilisation de base
### Mode de transmission simple
Sans définir un format d'entrée, le webhook transmet l'intégralité du corps de la requête tel quel :
```bash
curl -X POST https://sim.ai/api/webhooks/trigger/{webhook-path} \
-H "Content-Type: application/json" \
-H "X-Sim-Secret: your-secret" \
-d '{
"message": "Test webhook trigger",
"data": {
"key": "value"
}
}'
```
Accédez aux données dans les blocs en aval en utilisant :
- `<webhook1.message>` → "Test webhook trigger"
- `<webhook1.data.key>` → "value"
### Format d'entrée structuré (optionnel)
Définissez un schéma d'entrée pour obtenir des champs typés et activer des fonctionnalités avancées comme les téléchargements de fichiers :
**Configuration du format d'entrée :**
```json
[
{ "name": "message", "type": "string" },
{ "name": "priority", "type": "number" },
{ "name": "documents", "type": "files" }
]
```
**Requête webhook :**
```bash
curl -X POST https://sim.ai/api/webhooks/trigger/{webhook-path} \
-H "Content-Type: application/json" \
-H "X-Sim-Secret: your-secret" \
-d '{
"message": "Invoice submission",
"priority": 1,
"documents": [
{
"type": "file",
"data": "data:application/pdf;base64,JVBERi0xLjQK...",
"name": "invoice.pdf",
"mime": "application/pdf"
}
]
}'
```
## Téléchargements de fichiers
### Formats de fichiers pris en charge
Le webhook prend en charge deux formats d'entrée de fichiers :
#### 1. Fichiers encodés en Base64
Pour télécharger directement le contenu du fichier :
```json
{
"documents": [
{
"type": "file",
"data": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgA...",
"name": "screenshot.png",
"mime": "image/png"
}
]
}
```
- **Taille maximale** : 20 Mo par fichier
- **Format** : URL de données standard avec encodage base64
- **Stockage** : Les fichiers sont téléchargés dans un stockage d'exécution sécurisé
#### 2. Références URL
Pour transmettre des URL de fichiers existants :
```json
{
"documents": [
{
"type": "url",
"data": "https://example.com/files/document.pdf",
"name": "document.pdf",
"mime": "application/pdf"
}
]
}
```
### Accès aux fichiers dans les blocs en aval
Les fichiers sont traités en objets `UserFile` avec les propriétés suivantes :
```typescript
{
id: string, // Unique file identifier
name: string, // Original filename
url: string, // Presigned URL (valid for 5 minutes)
size: number, // File size in bytes
type: string, // MIME type
key: string, // Storage key
uploadedAt: string, // ISO timestamp
expiresAt: string // ISO timestamp (5 minutes)
}
```
**Accès dans les blocs :**
- `<webhook1.documents[0].url>` → URL de téléchargement
- `<webhook1.documents[0].name>` → "invoice.pdf"
- `<webhook1.documents[0].size>` → 524288
- `<webhook1.documents[0].type>` → "application/pdf"
### Exemple complet de téléchargement de fichier
```bash
# Create a base64-encoded file
echo "Hello World" | base64
# SGVsbG8gV29ybGQK
# Send webhook with file
curl -X POST https://sim.ai/api/webhooks/trigger/{webhook-path} \
-H "Content-Type: application/json" \
-H "X-Sim-Secret: your-secret" \
-d '{
"subject": "Document for review",
"attachments": [
{
"type": "file",
"data": "data:text/plain;base64,SGVsbG8gV29ybGQK",
"name": "sample.txt",
"mime": "text/plain"
}
]
}'
```
## Authentification
### Configurer l'authentification (facultatif)
Dans la configuration du webhook :
1. Activez "Exiger l'authentification"
2. Définissez un jeton secret
3. Choisissez le type d'en-tête :
- **En-tête personnalisé** : `X-Sim-Secret: your-token`
- **Autorisation Bearer** : `Authorization: Bearer your-token`
### Utilisation de l'authentification
```bash
# With custom header
curl -X POST https://sim.ai/api/webhooks/trigger/{webhook-path} \
-H "Content-Type: application/json" \
-H "X-Sim-Secret: your-secret-token" \
-d '{"message": "Authenticated request"}'
# With bearer token
curl -X POST https://sim.ai/api/webhooks/trigger/{webhook-path} \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-secret-token" \
-d '{"message": "Authenticated request"}'
```
## Bonnes pratiques
1. **Utilisez le format d'entrée pour la structure** : définissez un format d'entrée lorsque vous connaissez le schéma attendu. Cela fournit :
- Validation de type
- Meilleure autocomplétion dans l'éditeur
- Capacités de téléchargement de fichiers
2. **Authentification** : activez toujours l'authentification pour les webhooks de production afin d'empêcher les accès non autorisés.
3. **Limites de taille de fichier** : gardez les fichiers sous 20 Mo. Pour les fichiers plus volumineux, utilisez plutôt des références URL.
4. **Expiration des fichiers** : les fichiers téléchargés ont des URL d'expiration de 5 minutes. Traitez-les rapidement ou stockez-les ailleurs si vous en avez besoin plus longtemps.
5. **Gestion des erreurs** : le traitement des webhooks est asynchrone. Vérifiez les journaux d'exécution pour les erreurs.
6. **Tests** : utilisez le bouton "Tester le webhook" dans l'éditeur pour valider votre configuration avant le déploiement.
## Cas d'utilisation
- **Soumissions de formulaires** : recevez des données de formulaires personnalisés avec téléchargements de fichiers
- **Intégrations tierces** : connectez-vous à des services qui envoient des webhooks (Stripe, GitHub, etc.)
- **Traitement de documents** : acceptez des documents de systèmes externes pour traitement
- **Notifications d'événements** : recevez des données d'événements de diverses sources
- **API personnalisées** : créez des points de terminaison API personnalisés pour vos applications
## Remarques
- Catégorie : `triggers`
- Type : `generic_webhook`
- **Support de fichiers** : disponible via la configuration du format d'entrée
- **Taille maximale de fichier** : 20 Mo par fichier

View File

@@ -22,7 +22,210 @@ import { BlockInfoCard } from "@/components/ui/block-info-card"
</svg>`}
/>
## 概要
Generic Webhookブロックは、外部サービスからのWebhookを受信することができます。これはあらゆるJSONペイロードを処理できる柔軟なトリガーであり、専用のSimブロックを持たないサービスとの統合に最適です。
## 基本的な使用方法
### シンプルなパススルーモード
入力フォーマットを定義しない場合、Webhookはリクエスト本文全体をそのまま渡します
```bash
curl -X POST https://sim.ai/api/webhooks/trigger/{webhook-path} \
-H "Content-Type: application/json" \
-H "X-Sim-Secret: your-secret" \
-d '{
"message": "Test webhook trigger",
"data": {
"key": "value"
}
}'
```
下流のブロックでデータにアクセスする方法:
- `<webhook1.message>` → "Test webhook trigger"
- `<webhook1.data.key>` → "value"
### 構造化入力フォーマット(オプション)
入力スキーマを定義して、型付きフィールドを取得し、ファイルアップロードなどの高度な機能を有効にします:
**入力フォーマット設定:**
```json
[
{ "name": "message", "type": "string" },
{ "name": "priority", "type": "number" },
{ "name": "documents", "type": "files" }
]
```
**Webhookリクエスト**
```bash
curl -X POST https://sim.ai/api/webhooks/trigger/{webhook-path} \
-H "Content-Type: application/json" \
-H "X-Sim-Secret: your-secret" \
-d '{
"message": "Invoice submission",
"priority": 1,
"documents": [
{
"type": "file",
"data": "data:application/pdf;base64,JVBERi0xLjQK...",
"name": "invoice.pdf",
"mime": "application/pdf"
}
]
}'
```
## ファイルアップロード
### サポートされているファイル形式
Webhookは2つのファイル入力形式をサポートしています
#### 1. Base64エンコードファイル
ファイルコンテンツを直接アップロードする場合:
```json
{
"documents": [
{
"type": "file",
"data": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgA...",
"name": "screenshot.png",
"mime": "image/png"
}
]
}
```
- **最大サイズ**: ファイルあたり20MB
- **フォーマット**: Base64エンコーディングを使用した標準データURL
- **ストレージ**: ファイルは安全な実行ストレージにアップロードされます
#### 2. URL参照
既存のファイルURLを渡す場合
```json
{
"documents": [
{
"type": "url",
"data": "https://example.com/files/document.pdf",
"name": "document.pdf",
"mime": "application/pdf"
}
]
}
```
### 下流ブロックでのファイルへのアクセス
ファイルは以下のプロパティを持つ`UserFile`オブジェクトに処理されます:
```typescript
{
id: string, // Unique file identifier
name: string, // Original filename
url: string, // Presigned URL (valid for 5 minutes)
size: number, // File size in bytes
type: string, // MIME type
key: string, // Storage key
uploadedAt: string, // ISO timestamp
expiresAt: string // ISO timestamp (5 minutes)
}
```
**ブロックでのアクセス:**
- `<webhook1.documents[0].url>` → ダウンロードURL
- `<webhook1.documents[0].name>` → "invoice.pdf"
- `<webhook1.documents[0].size>` → 524288
- `<webhook1.documents[0].type>` → "application/pdf"
### 完全なファイルアップロード例
```bash
# Create a base64-encoded file
echo "Hello World" | base64
# SGVsbG8gV29ybGQK
# Send webhook with file
curl -X POST https://sim.ai/api/webhooks/trigger/{webhook-path} \
-H "Content-Type: application/json" \
-H "X-Sim-Secret: your-secret" \
-d '{
"subject": "Document for review",
"attachments": [
{
"type": "file",
"data": "data:text/plain;base64,SGVsbG8gV29ybGQK",
"name": "sample.txt",
"mime": "text/plain"
}
]
}'
```
## 認証
### 認証の設定(オプション)
Webhookの設定で
1. 「認証を要求する」を有効にする
2. シークレットトークンを設定する
3. ヘッダータイプを選択する:
- **カスタムヘッダー**`X-Sim-Secret: your-token`
- **認証ベアラー**`Authorization: Bearer your-token`
### 認証の使用
```bash
# With custom header
curl -X POST https://sim.ai/api/webhooks/trigger/{webhook-path} \
-H "Content-Type: application/json" \
-H "X-Sim-Secret: your-secret-token" \
-d '{"message": "Authenticated request"}'
# With bearer token
curl -X POST https://sim.ai/api/webhooks/trigger/{webhook-path} \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-secret-token" \
-d '{"message": "Authenticated request"}'
```
## ベストプラクティス
1. **構造化のための入力フォーマットを使用する**:予想されるスキーマがわかっている場合は入力フォーマットを定義してください。これにより以下が提供されます:
- 型の検証
- エディタでのより良いオートコンプリート
- ファイルアップロード機能
2. **認証**不正アクセスを防ぐため、本番環境のWebhookには常に認証を有効にしてください。
3. **ファイルサイズの制限**ファイルは20MB未満に保つようにしてください。より大きなファイルの場合は、代わりにURL参照を使用してください。
4. **ファイルの有効期限**ダウンロードされたファイルのURLは5分間有効です。すぐに処理するか、長期間必要な場合は別の場所に保存してください。
5. **エラー処理**Webhook処理は非同期です。エラーについては実行ログを確認してください。
6. **テスト**デプロイ前に設定を検証するために、エディタの「Webhookをテスト」ボタンを使用してください。
## ユースケース
- **フォーム送信**:ファイルアップロード機能を持つカスタムフォームからデータを受け取る
- **サードパーティ連携**Webhookを送信するサービスStripe、GitHubなどと接続する
- **ドキュメント処理**:外部システムからドキュメントを受け取って処理する
- **イベント通知**:様々なソースからイベントデータを受け取る
- **カスタムAPI**アプリケーション用のカスタムAPIエンドポイントを構築する
## 注意事項
- カテゴリー: `triggers`
- タイプ: `generic_webhook`
- カテゴリ`triggers`
- タイプ`generic_webhook`
- **ファイルサポート**:入力フォーマット設定で利用可能
- **最大ファイルサイズ**ファイルあたり20MB

View File

@@ -22,7 +22,210 @@ import { BlockInfoCard } from "@/components/ui/block-info-card"
</svg>`}
/>
## 概述
通用 Webhook 模块允许您接收来自任何外部服务的 webhook。这是一个灵活的触发器可以处理任何 JSON 负载,非常适合与没有专用 Sim 模块的服务集成。
## 基本用法
### 简单直通模式
在未定义输入格式的情况下webhook 会按原样传递整个请求正文:
```bash
curl -X POST https://sim.ai/api/webhooks/trigger/{webhook-path} \
-H "Content-Type: application/json" \
-H "X-Sim-Secret: your-secret" \
-d '{
"message": "Test webhook trigger",
"data": {
"key": "value"
}
}'
```
在下游模块中访问数据:
- `<webhook1.message>` → "测试 webhook 触发器"
- `<webhook1.data.key>` → "值"
### 结构化输入格式(可选)
定义输入模式以获取类型化字段,并启用高级功能,例如文件上传:
**输入格式配置:**
```json
[
{ "name": "message", "type": "string" },
{ "name": "priority", "type": "number" },
{ "name": "documents", "type": "files" }
]
```
**Webhook 请求:**
```bash
curl -X POST https://sim.ai/api/webhooks/trigger/{webhook-path} \
-H "Content-Type: application/json" \
-H "X-Sim-Secret: your-secret" \
-d '{
"message": "Invoice submission",
"priority": 1,
"documents": [
{
"type": "file",
"data": "data:application/pdf;base64,JVBERi0xLjQK...",
"name": "invoice.pdf",
"mime": "application/pdf"
}
]
}'
```
## 文件上传
### 支持的文件格式
webhook 支持两种文件输入格式:
#### 1. Base64 编码文件
用于直接上传文件内容:
```json
{
"documents": [
{
"type": "file",
"data": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgA...",
"name": "screenshot.png",
"mime": "image/png"
}
]
}
```
- **最大大小**:每个文件 20MB
- **格式**:带有 base64 编码的标准数据 URL
- **存储**:文件上传到安全的执行存储
#### 2. URL 引用
用于传递现有文件的 URL
```json
{
"documents": [
{
"type": "url",
"data": "https://example.com/files/document.pdf",
"name": "document.pdf",
"mime": "application/pdf"
}
]
}
```
### 在下游模块中访问文件
文件被处理为 `UserFile` 对象,具有以下属性:
```typescript
{
id: string, // Unique file identifier
name: string, // Original filename
url: string, // Presigned URL (valid for 5 minutes)
size: number, // File size in bytes
type: string, // MIME type
key: string, // Storage key
uploadedAt: string, // ISO timestamp
expiresAt: string // ISO timestamp (5 minutes)
}
```
**在模块中访问:**
- `<webhook1.documents[0].url>` → 下载 URL
- `<webhook1.documents[0].name>` → "invoice.pdf"
- `<webhook1.documents[0].size>` → 524288
- `<webhook1.documents[0].type>` → "application/pdf"
### 完整的文件上传示例
```bash
# Create a base64-encoded file
echo "Hello World" | base64
# SGVsbG8gV29ybGQK
# Send webhook with file
curl -X POST https://sim.ai/api/webhooks/trigger/{webhook-path} \
-H "Content-Type: application/json" \
-H "X-Sim-Secret: your-secret" \
-d '{
"subject": "Document for review",
"attachments": [
{
"type": "file",
"data": "data:text/plain;base64,SGVsbG8gV29ybGQK",
"name": "sample.txt",
"mime": "text/plain"
}
]
}'
```
## 身份验证
### 配置身份验证(可选)
在 webhook 配置中:
1. 启用“需要身份验证”
2. 设置一个密钥令牌
3. 选择头类型:
- **自定义头**`X-Sim-Secret: your-token`
- **授权 Bearer**`Authorization: Bearer your-token`
### 使用身份验证
```bash
# With custom header
curl -X POST https://sim.ai/api/webhooks/trigger/{webhook-path} \
-H "Content-Type: application/json" \
-H "X-Sim-Secret: your-secret-token" \
-d '{"message": "Authenticated request"}'
# With bearer token
curl -X POST https://sim.ai/api/webhooks/trigger/{webhook-path} \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-secret-token" \
-d '{"message": "Authenticated request"}'
```
## 最佳实践
1. **使用输入格式定义结构**:当您知道预期的模式时,定义一个输入格式。这可以提供:
- 类型验证
- 编辑器中的更好自动完成
- 文件上传功能
2. **身份验证**:在生产环境的 webhook 中始终启用身份验证,以防止未经授权的访问。
3. **文件大小限制**:将文件保持在 20MB 以下。对于更大的文件,请使用 URL 引用。
4. **文件过期**:下载的文件具有 5 分钟的过期 URL。请及时处理或者如果需要更长时间请将其存储在其他地方。
5. **错误处理**Webhook 处理是异步的。请检查执行日志以获取错误信息。
6. **测试**:在部署之前,使用编辑器中的“测试 Webhook”按钮验证您的配置。
## 使用场景
- **表单提交**:接收带有文件上传的自定义表单数据
- **第三方集成**:与发送 webhook 的服务(如 Stripe、GitHub 等)连接
- **文档处理**:接受来自外部系统的文档进行处理
- **事件通知**:接收来自各种来源的事件数据
- **自定义 API**:为您的应用程序构建自定义 API 端点
## 注意事项
- 类别:`triggers`
- 类型:`generic_webhook`
- **文件支持**:通过输入格式配置可用
- **最大文件大小**:每个文件 20MB

View File

@@ -1976,8 +1976,49 @@ checksums:
meta/description: 13b4e5bceef6d1104e43d51d90fecf8e
content/0: 1b031fb0c62c46b177aeed5c3d3f8f80
content/1: a64277f09df51b99fcab31e92e106bed
content/2: b3f310d5ef115bea5a8b75bf25d7ea9a
content/3: 022b9e1e834f93bde611735a90c74ba8
content/2: 5e26527ccf8fddebe14c951e6c950b48
content/3: 18ab8a5892057b2629fdfa132c2bc99a
content/4: baefde094f2a3704e6963aa421acaba8
content/5: 21a69e345e1a48693ec398944754e999
content/6: 0c629dceccb0e3e2ba75dbb1a4757987
content/7: f3a38c0a13142335909263ee91899103
content/8: cba70dd7b00b275a91ded8755c3a0741
content/9: 782b550d15a06ff720e316057186022c
content/10: 75896132f96a46231588ee76b7a506dc
content/11: a9b57b3847a0b8d70d5315c0f96a9536
content/12: c9e7936c077be80272652b2dd30fd526
content/13: 6121e3dd3e9baebe39b10b59e2491fa6
content/14: 2c4c871ac88150beef559daa47957453
content/15: ee4064a3cf3cb394ba54cf208594890c
content/16: ec271420ee6f2ce91d8f900608b9261f
content/17: d0753484fe8f1c09124125d79dbd9beb
content/18: 8da01046db7127b6c454caa496b8b296
content/19: 5523f2e7b97e275e10cf55cf3f57afa7
content/20: b4857e265e096231a4f24be0d06987b6
content/21: d70affff7ccc15240cef59b8209f9e9c
content/22: 442299d79ced71d4bb59f4b0a46392a2
content/23: 08b6cfb90eb5a35b8511d88fe8c16fc3
content/24: b43a90f01b6192d918c3c1f2cddd2922
content/25: a63f15d6e9297c0731b40a8032be04c8
content/26: 16f4a97df43e4aaeff8614ad03bb4c6f
content/27: 7fd3613d3a651d0d5ce51d7f2049423d
content/28: d5ba126133858f23e7fc30e011c1e072
content/29: 4823775c5e1761754746a7bbd5486a1f
content/30: 6853158a0939b8ab539be1fda64c32da
content/31: 6d0006483a113fae930129b8daad43ad
content/32: a4a19b0692b9f0d6f6902e3dd65a887c
content/33: 2f430eafb54450f831b5acaecd97521f
content/34: b2a4a0c279f47d58a2456f25a1e1c6f9
content/35: 85c4d9ebf5a747f41505a57ff6ca3efa
content/36: 17033c46dca6954cfa35f364b9266cee
content/37: cc88c2e6e25b0ae8137daaf58e21a652
content/38: 1da265c4acca0e7a67efeec6884c08da
content/39: 4e062ddba9017e5918d98c3b71678129
content/40: 70df181932b7b36579ffc58bd22d3c53
content/41: 7a3be8a3771ee428ecf09008e42c0e2e
content/42: 9b4ff8b0793fc4337013bfcb316e2527
content/43: b3f310d5ef115bea5a8b75bf25d7ea9a
content/44: b2be17c101ec30b82d041616ab032a93
87beb559b312b9213347ee94e6506ae4:
meta/title: d8c4eebcc6c59235473743065c13300e
meta/description: 5e6724c34383ec8608d3713d0029c974