Skip to content

feat(integrations): add brandfetch integration#3402

Merged
waleedlatif1 merged 3 commits intostagingfrom
waleedlatif1/add-brandfetch
Mar 3, 2026
Merged

feat(integrations): add brandfetch integration#3402
waleedlatif1 merged 3 commits intostagingfrom
waleedlatif1/add-brandfetch

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

  • Add Brandfetch integration with Get Brand and Search operations
  • Supports lookup by domain, stock ticker, ISIN, or crypto symbol
  • Returns brand logos, colors, fonts, social links, and company data

Type of Change

  • New feature

Testing

Tested manually

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)

@vercel
Copy link

vercel bot commented Mar 3, 2026

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Mar 3, 2026 5:57am

Request Review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 3, 2026

Greptile Summary

This PR adds a Brandfetch integration with two operations — Get Brand (lookup by domain, ticker, ISIN, or crypto symbol) and Search Brands (lookup by name) — following the established block/tool architecture used by other integrations in the codebase. It includes the block config, both tool implementations, shared TypeScript types, icon components for both apps, documentation, and registry entries.

  • The block is correctly structured with AuthMode.ApiKey, a switch-with-default for tool selection, and conditional field visibility per operation.
  • apiKey correctly uses visibility: 'user-only' in both tool params, consistent with the project rule for user-provided credentials.
  • The transformResponse in search.ts uses item.brandId ?? '', silently coercing a null brandId to an empty string. Unlike name and icon (correctly preserved as null), this loses semantic distinction for the primary brand identifier, which could mislead callers attempting downstream lookups.
  • Both get_brand.ts and search.ts read error response bodies with response.text(), but the Brandfetch API returns structured JSON errors (e.g., {"message":"Brand not found"}). Parsing the JSON and extracting message would produce cleaner error output.

Confidence Score: 4/5

  • This PR is safe to merge with minor style improvements recommended.
  • The integration follows established patterns correctly, auth is handled properly, and no critical logic errors were found. The two remaining issues (brandId null coercion and plain-text error parsing) are style-level concerns that won't cause failures in the happy path, but could degrade the developer/user experience in edge cases.
  • apps/sim/tools/brandfetch/search.ts and apps/sim/tools/brandfetch/get_brand.ts deserve a second look for the brandId coercion and error body parsing.

Important Files Changed

Filename Overview
apps/sim/tools/brandfetch/get_brand.ts Implements the Get Brand tool with correct auth (user-only visibility), URL encoding, and response normalization; minor issue with JSON error bodies being read as plain text.
apps/sim/tools/brandfetch/search.ts Implements the Search Brands tool correctly; brandId ?? '' coerces null to empty string, losing semantic distinction for a primary identifier, and JSON error bodies are read as plain text.
apps/sim/tools/brandfetch/types.ts Defines all Brandfetch types; BrandFont.type/origin and BrandColor.type may need to be `string
apps/sim/blocks/blocks/brandfetch.ts Block config is well-structured with correct AuthMode.ApiKey, conditional field visibility, and a switch statement with a default fallback for the tool selector.
apps/sim/tools/brandfetch/index.ts Clean barrel export for tools and types; no issues found.

Sequence Diagram

sequenceDiagram
    participant User
    participant BrandfetchBlock
    participant GetBrandTool
    participant SearchTool
    participant BrandfetchAPI

    User->>BrandfetchBlock: Select operation + provide params

    alt operation = get_brand
        BrandfetchBlock->>GetBrandTool: identifier, apiKey
        GetBrandTool->>BrandfetchAPI: GET /v2/brands/{identifier}<br/>Authorization: Bearer {apiKey}
        BrandfetchAPI-->>GetBrandTool: { id, name, domain, logos, colors, fonts, company, ... }
        GetBrandTool-->>BrandfetchBlock: BrandfetchGetBrandResponse
    else operation = search
        BrandfetchBlock->>SearchTool: name, apiKey
        SearchTool->>BrandfetchAPI: GET /v2/search/{name}<br/>Authorization: Bearer {apiKey}
        BrandfetchAPI-->>SearchTool: [ { brandId, name, domain, claimed, icon }, ... ]
        SearchTool-->>BrandfetchBlock: BrandfetchSearchResponse
    end

    BrandfetchBlock-->>User: Output (brand assets or search results)
Loading

Last reviewed commit: 9006f1b

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Autofix Details

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Search Tool Uses Wrong Authentication Method
    • Changed authentication from Bearer token in Authorization header to clientId query parameter (?c=) as required by Brandfetch Search API v2.

Create PR

Or push these changes by commenting:

@cursor push 5ff54bf5ed
Preview (5ff54bf5ed)
diff --git a/apps/sim/tools/brandfetch/search.ts b/apps/sim/tools/brandfetch/search.ts
--- a/apps/sim/tools/brandfetch/search.ts
+++ b/apps/sim/tools/brandfetch/search.ts
@@ -24,10 +24,9 @@
 
   request: {
     url: (params) =>
-      `https://api.brandfetch.io/v2/search/${encodeURIComponent(params.name.trim())}`,
+      `https://api.brandfetch.io/v2/search/${encodeURIComponent(params.name.trim())}?c=${params.apiKey}`,
     method: 'GET',
-    headers: (params) => ({
-      Authorization: `Bearer ${params.apiKey}`,
+    headers: () => ({
       Accept: 'application/json',
     }),
   },
This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.

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.

12 files reviewed, 8 comments

Edit Code Review Agent Settings | Greptile

@waleedlatif1
Copy link
Collaborator Author

@greptile

@waleedlatif1
Copy link
Collaborator Author

@cursor review

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

@waleedlatif1
Copy link
Collaborator Author

@greptile

@waleedlatif1
Copy link
Collaborator Author

@cursor review

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

@waleedlatif1 waleedlatif1 merged commit 6fa4b9b into staging Mar 3, 2026
12 checks passed
@waleedlatif1 waleedlatif1 deleted the waleedlatif1/add-brandfetch branch March 3, 2026 06:10
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.

1 participant