Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions apps/docs/components/icons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2533,6 +2533,24 @@ l57 -85 -48 -124 c-203 -517 -79 -930 346 -1155 159 -85 441 -71 585 28 l111
)
}

export function BufferIcon(props: SVGProps<SVGSVGElement>) {
return (
<svg
{...props}
viewBox='0 0 86.7 97.9'
fill='currentColor'
role='img'
xmlns='http://www.w3.org/2000/svg'
>
<path
fillRule='evenodd'
clipRule='evenodd'
d='M0,22.3L43.1,0l43.6,22.3L43.1,44.8L0,22.3z M43.1,83.1l-29.4-16L0,74.5l43.1,23.4l43.6-23.4l-13.9-7.4 L43.1,83.1z M13.7,42l29.4,14.5L72.9,42l13.9,6.8L43.1,69.9L0,48.7L13.7,42z'
/>
</svg>
)
}

export function Mem0Icon(props: SVGProps<SVGSVGElement>) {
return (
<svg
Expand Down
2 changes: 2 additions & 0 deletions apps/docs/components/ui/icon-mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
BrexIcon,
BrightDataIcon,
BrowserUseIcon,
BufferIcon,
CalComIcon,
CalendlyIcon,
CirclebackIcon,
Expand Down Expand Up @@ -264,6 +265,7 @@ export const blockTypeToIconMap: Record<string, IconComponent> = {
brex: BrexIcon,
brightdata: BrightDataIcon,
browser_use: BrowserUseIcon,
buffer: BufferIcon,
calcom: CalComIcon,
calendly: CalendlyIcon,
circleback: CirclebackIcon,
Expand Down
355 changes: 355 additions & 0 deletions apps/docs/content/docs/en/integrations/buffer.mdx

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions apps/docs/content/docs/en/integrations/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"brex",
"brightdata",
"browser_use",
"buffer",
"calcom",
"calendly",
"circleback",
Expand Down
69 changes: 69 additions & 0 deletions apps/sim/app/api/tools/buffer/create-post/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import { createLogger } from '@sim/logger'
import { getErrorMessage } from '@sim/utils/errors'
import { type NextRequest, NextResponse } from 'next/server'
import { bufferCreatePostContract } from '@/lib/api/contracts/tools/buffer'
import { getValidationErrorMessage, parseRequest } from '@/lib/api/server'
import { checkInternalAuth } from '@/lib/auth/hybrid'
import { generateRequestId } from '@/lib/core/utils/request'
import { withRouteHandler } from '@/lib/core/utils/with-route-handler'
import { forwardPostMutation } from '@/app/api/tools/buffer/server-utils'

export const dynamic = 'force-dynamic'

const logger = createLogger('BufferCreatePostAPI')

export const POST = withRouteHandler(async (request: NextRequest) => {
const requestId = generateRequestId()

try {
const authResult = await checkInternalAuth(request, { requireWorkflowId: false })
if (!authResult.success || !authResult.userId) {
logger.warn(`[${requestId}] Unauthorized Buffer create post attempt`, {
error: authResult.error || 'Missing userId',
})
return NextResponse.json(
{ success: false, error: authResult.error || 'Unauthorized' },
{ status: 401 }
)
}

const parsed = await parseRequest(
bufferCreatePostContract,
request,
{},
{
validationErrorResponse: (error) => {
logger.warn(`[${requestId}] Invalid request data`, { errors: error.issues })
return NextResponse.json(
{
success: false,
error: getValidationErrorMessage(error, 'Invalid request data'),
},
{ status: 400 }
)
},
}
)
if (!parsed.success) return parsed.response
const body = parsed.data.body

return await forwardPostMutation({
apiKey: body.apiKey,
channelId: body.channelId,
text: body.text,
mode: body.mode,
schedulingType: body.schedulingType,
dueAt: body.dueAt,
saveToDraft: body.saveToDraft,
media: body.media,
mediaAltText: body.mediaAltText,
userId: authResult.userId,
requestId,
logger,
})
} catch (error) {
const message = getErrorMessage(error, 'Failed to create post')
logger.error(`[${requestId}] Buffer create post failed`, { error: message })
return NextResponse.json({ success: false, error: message }, { status: 500 })
}
})
69 changes: 69 additions & 0 deletions apps/sim/app/api/tools/buffer/edit-post/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import { createLogger } from '@sim/logger'
import { getErrorMessage } from '@sim/utils/errors'
import { type NextRequest, NextResponse } from 'next/server'
import { bufferEditPostContract } from '@/lib/api/contracts/tools/buffer'
import { getValidationErrorMessage, parseRequest } from '@/lib/api/server'
import { checkInternalAuth } from '@/lib/auth/hybrid'
import { generateRequestId } from '@/lib/core/utils/request'
import { withRouteHandler } from '@/lib/core/utils/with-route-handler'
import { forwardPostMutation } from '@/app/api/tools/buffer/server-utils'

export const dynamic = 'force-dynamic'

const logger = createLogger('BufferEditPostAPI')

export const POST = withRouteHandler(async (request: NextRequest) => {
const requestId = generateRequestId()

try {
const authResult = await checkInternalAuth(request, { requireWorkflowId: false })
if (!authResult.success || !authResult.userId) {
logger.warn(`[${requestId}] Unauthorized Buffer edit post attempt`, {
error: authResult.error || 'Missing userId',
})
return NextResponse.json(
{ success: false, error: authResult.error || 'Unauthorized' },
{ status: 401 }
)
}

const parsed = await parseRequest(
bufferEditPostContract,
request,
{},
{
validationErrorResponse: (error) => {
logger.warn(`[${requestId}] Invalid request data`, { errors: error.issues })
return NextResponse.json(
{
success: false,
error: getValidationErrorMessage(error, 'Invalid request data'),
},
{ status: 400 }
)
},
}
)
if (!parsed.success) return parsed.response
const body = parsed.data.body

return await forwardPostMutation({
apiKey: body.apiKey,
postId: body.postId,
text: body.text,
mode: body.mode,
schedulingType: body.schedulingType,
dueAt: body.dueAt,
saveToDraft: body.saveToDraft,
media: body.media,
mediaAltText: body.mediaAltText,
userId: authResult.userId,
requestId,
logger,
})
} catch (error) {
const message = getErrorMessage(error, 'Failed to edit post')
logger.error(`[${requestId}] Buffer edit post failed`, { error: message })
return NextResponse.json({ success: false, error: message }, { status: 500 })
}
})
Loading
Loading