Channel ingestion

From NaveedTechLab/skills-library · View interactive version

Channel ingestion is an AI agent skill from the GitHub repository NaveedTechLab/skills-library. Implements FastAPI endpoints and webhook handlers for Gmail API, Twilio WhatsApp, and the Web Support Form. Handles message normalization and initial ingestion into the system. Use when Claude needs to create or modify webhook endpoints for multi-channel message ingestion, normalize messages from di

How to use this skill

Skill file

Channel Ingestion Skill

This skill provides guidance for implementing multi-channel message ingestion with FastAPI endpoints and webhook handlers for Gmail API, Twilio WhatsApp, and Web Support Form integration.

Overview

The channel ingestion system handles incoming messages from multiple sources:

All messages are normalized to a common format before being ingested into the system.

Key Components

1. FastAPI Endpoints Structure

When creating webhook endpoints, follow this pattern:

from fastapi import FastAPI, Request, HTTPException
from typing import Dict, Any
import json

app = FastAPI()

@app.post("/webhook/gmail")
async def gmail_webhook(request: Request):
    # Handle Gmail API webhook
    pass

@app.post("/webhook/twilio-whatsapp")
async def twilio_whatsapp_webhook(request: Request):
    # Handle Twilio WhatsApp webhook
    pass

@app.post("/webhook/web-support-form")
async def web_support_form_webhook(request: Request):
    # Handle web form submission
    pass

2. Message Normalization

All incoming messages should be normalized to a common format:

from pydantic import BaseModel
from datetime import datetime
from enum import Enum
from typing import Optional, Dict, Any

class ChannelType(str, Enum):
    EMAIL = "email"
    WHATSAPP = "whatsapp"
    WEB_FORM = "web_form"

class NormalizedMessage(BaseModel):
    id: str
    channel: ChannelType
    sender_id: str
    sender_name: Optional[str] = None
    content: str
    timestamp: datetime
    metadata: Dict[str, Any] = {}
    attachments: Optional[list] = []

3. Gmail API Integration

Gmail webhook endpoints should handle:

4. Twilio WhatsApp Integration

Twilio webhook endpoints should handle:

5. Web Support Form Integration

Web form endpoints should handle:

Implementation Guidelines

Security Best Practices

  1. Authentication & Verification:
  1. Input Validation:
  1. Rate Limiting:

Error Handling

Message Processing Pipeline

  1. Receive webhook request
  2. Validate authentication/signature
  3. Parse raw message format
  4. Normalize to common format
  5. Store in message queue/database
  6. Trigger downstream processing

Reference Files

For detailed implementation patterns, see:

When NOT to Use This Skill

Common Mistakes

Related Skills

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.