Skip to content

fix(clay): fixed clay tool#1725

Merged
waleedlatif1 merged 5 commits intostagingfrom
fix/clay
Oct 27, 2025
Merged

fix(clay): fixed clay tool#1725
waleedlatif1 merged 5 commits intostagingfrom
fix/clay

Conversation

@aadamgough
Copy link
Contributor

Summary

Made clay auth token optional, and fixed header

Type of Change

  • Bug fix

Testing

Tested with and without clay auth token

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Screenshots/Videos

Screen.Recording.2025-10-24.at.3.13.13.PM.mov

@vercel
Copy link

vercel bot commented Oct 24, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
docs Ready Ready Preview Comment Oct 27, 2025 1:28am

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Overview

Greptile Summary

Fixed Clay webhook authentication by making the auth token optional and correcting the header name from Authorization: Bearer to x-clay-webhook-auth.

Key Changes

  • Made authToken parameter optional across block UI and tool configuration
  • Corrected authentication header from Authorization: Bearer to x-clay-webhook-auth per Clay's API requirements
  • Enhanced response output to include metadata (status, headers, timestamp, content type)
  • Updated UI descriptions to clarify that auth tokens are only needed when webhook authentication is enabled

Issues Found

  • TypeScript type mismatch: apps/sim/tools/clay/types.ts wasn't updated to include the new metadata field in ClayPopulateResponse, causing type safety issues

Confidence Score: 3/5

  • This PR fixes critical authentication issues but has a type safety bug that needs resolution before merge
  • The core logic changes are correct and well-implemented (fixing auth header, making token optional), but the TypeScript types in types.ts weren't updated to match the new output structure with metadata field, which will cause type errors at compile time
  • The missing file apps/sim/tools/clay/types.ts needs to be updated to include the metadata field in ClayPopulateResponse interface

Important Files Changed

File Analysis

Filename Score Overview
apps/sim/blocks/blocks/clay.ts 5/5 Made auth token optional with clear description - UI changes look good
apps/sim/tools/clay/populate.ts 4/5 Fixed header name and made auth optional, added metadata output - TypeScript types need update

Sequence Diagram

sequenceDiagram
    participant User
    participant ClayBlock as Clay Block UI
    participant ClayTool as Clay Populate Tool
    participant ClayAPI as Clay Webhook API

    User->>ClayBlock: Configure webhook URL & data
    opt Auth Token Provided
        User->>ClayBlock: Enter auth token (optional)
    end
    
    User->>ClayBlock: Trigger populate action
    ClayBlock->>ClayTool: Call clay_populate(webhookURL, data, authToken?)
    
    ClayTool->>ClayTool: Build headers (Content-Type)
    alt authToken exists and not empty
        ClayTool->>ClayTool: Add x-clay-webhook-auth header
    end
    
    ClayTool->>ClayAPI: POST request with data
    ClayAPI-->>ClayTool: Response (JSON or text)
    
    ClayTool->>ClayTool: Extract headers & metadata
    ClayTool->>ClayTool: Parse response body
    ClayTool->>ClayTool: Build output with data & metadata
    
    ClayTool-->>ClayBlock: Return {data, metadata}
    ClayBlock-->>User: Display response with metadata
Loading

Additional Comments (1)

  1. apps/sim/tools/clay/types.ts, line 9-13 (link)

    logic: The ClayPopulateResponse type is missing the metadata field that was added to the tool's output. The response now includes both data and metadata fields.

2 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants