Skip to content

feat(buffer): add Buffer integration with posts, channels, and ideas#5637

Merged
waleedlatif1 merged 6 commits into
stagingfrom
worktree-buffer-integration
Jul 13, 2026
Merged

feat(buffer): add Buffer integration with posts, channels, and ideas#5637
waleedlatif1 merged 6 commits into
stagingfrom
worktree-buffer-integration

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Add Buffer integration (GraphQL API at api.buffer.com, Bearer API key auth) with 8 tools: create/edit/delete/get post, get posts, get channels, get account, create idea
  • Create Post / Edit Post support image and video attachments via internal routes (/api/tools/buffer/create-post, /api/tools/buffer/edit-post) that verify file access and mint short-lived presigned URLs, since Buffer only accepts publicly fetchable media URLs
  • Full share-mode support: addToQueue, shareNext, shareNow, customScheduled (with dueAt), plus drafts and notification-based publishing
  • Buffer block with operation dropdown, basic/advanced media inputs (canonicalParamId), status/channel filters with pagination, and BufferBlockMeta (8 templates, 5 skills)
  • Every GraphQL selection, input type, enum, and union validated against Buffer's live schema via introspection
  • Generated docs page; bumped route-count baseline for the 2 new contract-bound routes

Type of Change

  • New feature

Testing

Validated all GraphQL documents against Buffer's live schema (introspection + graphql-js validation); typecheck, lint, check:api-validation:strict, and check:bare-icons all pass

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

vercel Bot commented Jul 13, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Jul 13, 2026 7:00pm

Request Review

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor

cursor Bot commented Jul 13, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Workflows can publish or schedule real social posts using user API keys, and media handling performs outbound fetches (with DNS pinning); mistakes or bad inputs have external side effects rather than staying in-app.

Overview
Adds a Buffer marketing integration so workflows can manage social scheduling via Buffer’s GraphQL API (Bearer API key).

Capabilities: Ten tools cover post create/edit/delete/get/list (queue modes, drafts, custom dueAt, automatic vs notification publishing), connected channels, account/organizations, and ideas (create, list, idea groups). A workflow block wires an operation dropdown, filters/pagination for listing, and basic/advanced media inputs.

Media path: Because Buffer only accepts public asset URLs, create/edit post go through new internal routes (/api/tools/buffer/create-post, edit-post) with Zod contracts: internal auth, file access checks, short-lived presigned URLs, and image/video detection (MIME, extension, or DNS-pinned HEAD probe).

Also registers the block/tools, BufferIcon, docs (buffer.mdx), integrations.json entry, and bumps the API route validation baseline by 2 routes.

Reviewed by Cursor Bugbot for commit fa61c55. Configure here.

Comment thread apps/sim/tools/buffer/get_account.ts
@greptile-apps

greptile-apps Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds a Buffer integration for scheduling and managing social posts. The main changes are:

  • New Buffer tools for posts, channels, account data, ideas, and idea groups.
  • Internal create/edit routes that resolve media into public URLs for Buffer.
  • A Buffer block, icons, registry entries, contracts, and integration docs.

Confidence Score: 4/5

This is close, but the media handling should be fixed before merging.

  • Extensionless video URLs can still be classified as images when the probe is inconclusive.
  • The account null guard now fails with a controlled tool error.
  • Public URL handling remains limited to the string form, matching the route contract.

apps/sim/app/api/tools/buffer/server-utils.ts

Important Files Changed

Filename Overview
apps/sim/app/api/tools/buffer/server-utils.ts Adds Buffer post mutation forwarding and media resolution, but inconclusive media detection can still classify videos as images.
apps/sim/lib/api/contracts/tools/buffer.ts Defines the Buffer create/edit route contracts used by the internal media-forwarding routes.
apps/sim/tools/buffer/get_account.ts Adds a guard for missing Buffer account data before mapping the response.
apps/sim/blocks/blocks/buffer.ts Adds the Buffer block configuration and maps media inputs into the tool params.

Reviews (10): Last reviewed commit: "fix(buffer): guard missing post on PostA..." | Re-trigger Greptile

Comment thread apps/sim/tools/buffer/get_account.ts
@greptile-apps

greptile-apps Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds Buffer as a new social scheduling integration. The main changes are:

  • New Buffer block, registry entries, icons, and integration docs.
  • Eight Buffer tools for posts, channels, account data, and ideas.
  • Internal create/edit post routes for resolving media before Buffer GraphQL calls.
  • API contracts and route-count baseline updates for the new routes.

Confidence Score: 5/5

This looks safe to merge after a small media-input cleanup.

  • No blocking issues found in the changed code.
  • Public media URLs work as strings, but object-shaped public URLs can be rejected at validation.

apps/sim/lib/api/contracts/tools/buffer.ts

Important Files Changed

Filename Overview
apps/sim/app/api/tools/buffer/create-post/route.ts Adds the authenticated internal create-post route with contract validation and shared Buffer forwarding.
apps/sim/app/api/tools/buffer/edit-post/route.ts Adds the authenticated internal edit-post route using the same validated proxy flow.
apps/sim/app/api/tools/buffer/server-utils.ts Adds media resolution and Buffer GraphQL mutation forwarding for create/edit post.
apps/sim/lib/api/contracts/tools/buffer.ts Adds create/edit post route contracts, with one media-shape edge case noted for public URLs.
apps/sim/blocks/blocks/buffer.ts Adds the Buffer block configuration, subblocks, tool mapping, templates, and skills.
apps/sim/tools/buffer/types.ts Adds shared Buffer constants, GraphQL parsing, mappers, and response types.
apps/sim/tools/buffer/create_post.ts Adds the create-post tool that calls the internal proxy route.
apps/sim/tools/buffer/edit_post.ts Adds the edit-post tool that calls the internal proxy route.
apps/sim/tools/buffer/get_posts.ts Adds Buffer post listing with filters, pagination, and sorting.
apps/sim/tools/buffer/create_idea.ts Adds Buffer idea creation through the GraphQL API.
apps/sim/tools/registry.ts Registers all new Buffer tools.
apps/sim/blocks/registry-maps.ts Registers the Buffer block and metadata.
apps/docs/content/docs/en/integrations/buffer.mdx Adds the Buffer integration documentation page.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
  participant Workflow as Workflow Buffer Tool
  participant Route as Internal Buffer Route
  participant Files as File Resolver / Storage
  participant Buffer as Buffer GraphQL API

  Workflow->>Route: POST create/edit post with API key, text, mode, media
  Route->>Route: Internal auth and contract validation
  alt media provided
    Route->>Files: Resolve uploaded file, file reference, or public URL
    Files-->>Route: Public or presigned media URL
  end
  Route->>Buffer: createPost/editPost mutation
  Buffer-->>Route: PostActionSuccess or MutationError
  Route-->>Workflow: Normalized success or error response
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
  participant Workflow as Workflow Buffer Tool
  participant Route as Internal Buffer Route
  participant Files as File Resolver / Storage
  participant Buffer as Buffer GraphQL API

  Workflow->>Route: POST create/edit post with API key, text, mode, media
  Route->>Route: Internal auth and contract validation
  alt media provided
    Route->>Files: Resolve uploaded file, file reference, or public URL
    Files-->>Route: Public or presigned media URL
  end
  Route->>Buffer: createPost/editPost mutation
  Buffer-->>Route: PostActionSuccess or MutationError
  Route-->>Workflow: Normalized success or error response
Loading

Reviews (2): Last reviewed commit: "feat(buffer): add Buffer integration wit..." | Re-trigger Greptile

Comment thread apps/sim/lib/api/contracts/tools/buffer.ts
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/blocks/blocks/buffer.ts
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/app/api/tools/buffer/server-utils.ts
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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

Reviewed by Cursor Bugbot for commit 18fe14c. Configure here.

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/app/api/tools/buffer/server-utils.ts
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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

Reviewed by Cursor Bugbot for commit fa61c55. Configure here.

@waleedlatif1 waleedlatif1 merged commit 04535ee into staging Jul 13, 2026
18 checks passed
@waleedlatif1 waleedlatif1 deleted the worktree-buffer-integration branch July 13, 2026 19:07
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile review

Comment thread apps/sim/app/api/tools/buffer/server-utils.ts
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile review

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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

Reviewed by Cursor Bugbot for commit fa61c55. Configure here.

Comment thread apps/sim/app/api/tools/buffer/server-utils.ts
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile review

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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

Reviewed by Cursor Bugbot for commit fa61c55. Configure here.

Comment thread apps/sim/app/api/tools/buffer/server-utils.ts
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