webiny-sdk
하는 일
외부 앱을 Webiny의 헤드리스 콘텐츠 시스템에 연결해 콘텐츠를 가져오고, 만들고, 수정하고, 발행하는 방법을 보여 줍니다. Webiny에서 콘텐츠를 받는 웹사이트나 앱을 만드는 개발자를 위한 스킬입니다.
사용하는 경우
- ✓Webiny의 콘텐츠가 필요한 Next.js, Vue, Node.js 앱을 만들 때.
- ✓코드에서 Webiny 콘텐츠 항목을 발행하거나 발행 취소하고 싶을 때.
- ✓외부 앱에서 Webiny 콘텐츠를 필터링, 정렬, 페이지 나누기 하려는 경우.
스킬 링크
https://github.com/webiny/webiny-js/blob/next/skills/user-skills/webiny-sdk/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“Webiny에서 블로그 글을 가져와 제 Next.js 사이트에 표시하려면 어떻게 하나요?”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
이 스킬은 토큰과 엔드포인트로 SDK를 설정하고, 항목을 조회, 생성, 수정, 발행하는 메서드를 호출하는 방법을 보여 줍니다. 모든 호출은 코드가 확인하는 결과를 돌려줍니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
Webiny SDK
TL;DR
The @webiny/sdk package provides a TypeScript interface for external apps (Next.js, Vue, Node.js) to interact with Webiny's Headless CMS and File Manager. Every method returns a Result object (checked with isOk()). Supports listing, getting, creating, updating, publishing, and unpublishing entries with filtering, sorting, pagination, and TypeScript generics for type safety.
Installation & Setup
npm install @webiny/sdk
Initialize once and reuse:
// lib/webiny.ts
import { Webiny } from "@webiny/sdk";
export const webiny = new Webiny({
token: process.env.WEBINY_API_TOKEN!,
endpoint: process.env.WEBINY_API_ENDPOINT!,
tenant: process.env.WEBINY_API_TENANT || "root"
});
token-- API key token generated in Webiny Admin (Settings > API Keys)endpoint-- The base API URL, without a trailing slash. Runyarn webiny infoin your Webiny project to find the API URL. For Website Builder projects useNEXT_PUBLIC_WEBSITE_BUILDER_API_HOST.tenant-- Tenant ID, defaults to"root"
IMPORTANT: Never add a trailing slash to
endpoint. The SDK appends/graphqlto the endpoint internally, sohttps://xxx.cloudfront.net/will break all requests.
The fields Parameter (Required)
Every SDK method requires a fields array that specifies which fields to return. Omitting it will cause a runtime error.
- Use
"values.<fieldId>"for content fields:"values.name","values.price" - Use top-level field names for metadata:
"id","entryId","createdOn","status" - Use dot notation for nested fields:
"values.author.name"
// Minimal fields -- just IDs
fields: ["id", "entryId"];
// Content fields
fields: ["id", "entryId", "values.name", "values.price", "values.description"];
// Nested reference fields
fields: ["id", "values.title", "values.author.name", "values.author.email"];
CMS: Read vs Preview Mode
webiny.cms.listEntries and webiny.cms.getEntry accept a preview parameter to control which revisions are returned:
preview |
Returns | Use For |
|---|---|---|
false (default) |
Published entries only | Public-facing apps, SSG |
true |
Latest revision (draft or published) | Content preview, editorial tools |
Write operations (createEntry, updateEntryRevision, etc.) are not affected by preview.
The Result Pattern
Every SDK method returns a Result object -- it never throws:
const result = await webiny.cms.listEntries({
modelId: "product",
fields: ["id", "values.name"]
});
if (result.isOk()) {
console.log(result.value.data); // success -- typed data
} else {
console.error(result.error.message); // failure -- error info
}
TypeScript Generics
Pass a type parameter for full type safety on values:
import type { CmsEntryData } from "@webiny/sdk";
interface Product {
name: string;
price: number;
sku: string;
description: string;
category?: CmsEntryData<ProductCategory>;
}
interface ProductCategory {
name: string;
slug: string;
}
const result = await webiny.cms.listEntries<Product>({
modelId: "product",
fields: ["id", "entryId", "values.name", "values.price", "values.sku"]
});
if (result.isOk()) {
// result.value.data is CmsEntryData<Product>[]
const products = result.value.data;
// products[0].values.name -- fully typed
}
Reference fields like category are typed as CmsEntryData<T>, which wraps referenced entries with id, entryId, and values.
Reading Data
List Entries
const result = await webiny.cms.listEntries<Product>({
modelId: "product",
fields: ["id", "entryId", "values.name", "values.price"],
sort: { "values.name": "asc" },
limit: 10
});
List with Filters
const result = await webiny.cms.listEntries<Product>({
modelId: "product",
fields: ["id", "entryId", "values.name", "values.price"],
where: {
"values.price_gte": 100,
"values.name_contains": "Pro"
},
sort: { "values.price": "desc" }
});
Filter Operators
| Operator | Description | Example |
|---|---|---|
_eq |
Equals (default) | `"values.status |
자주 묻는 질문
API 토큰과 엔드포인트는 어디서 찾나요?
토큰은 Webiny 관리자의 API 키에서 만들고, 엔드포인트는 프로젝트에서 info 명령을 실행해 찾으라고 스킬이 설명합니다.
왜 모든 호출에 필드 목록이 필요한가요?
각 SDK 메서드는 반환할 항목을 적은 필드 목록이 필요하며, 이를 빼면 코드를 실행할 때 오류가 난다고 경고합니다.
엔드포인트 끝에 슬래시를 붙여야 하나요?
아닙니다. 끝에 슬래시가 있으면 모든 요청이 실패한다고 스킬이 경고합니다.
상세 정보
작성자의 원본 설명
Using @webiny/sdk to read and write CMS data from external applications. Use this skill when the developer is building a Next.js, Vue, Node.js, or any external app that needs to fetch or write content to Webiny, set up the SDK, use the Result pattern, list/get/create/update/publish entries, filter and sort queries, use TypeScript generics for type safety, work with the File Manager, list languages, trigger or monitor background tasks, or create API keys programmatically. Covers read vs preview mode, the `values` wrapper requirement, correct method names, and the `fields` required parameter, an
repo: webiny/webiny-js
인기도
- GitHub 스타
- 8.1k
- 순위
- #12617
- 라이선스
- —
- 업데이트
- 2026. 11. 2.
댓글
- …
이 저장소의 다른 스킬
prd-to-plan
8.1k에이전트가 제품 요구사항 문서를 작고 끝까지 이어지는 조각들로 된 단계별 계획으로 바꿔 Markdown 파일로 저장하도록 돕습니다.
webiny-admin-architect
8.1k에이전트에게 Webiny 플랫폼의 관리자 화면을 비즈니스 로직 계층과 프레젠터 패턴으로 만드는 방법을 가르칩니다.
webiny-admin-permissions
8.1k에이전트에게 Webiny 관리자 화면에 권한 제어를 추가하는 법을 가르칩니다. 스키마에서 권한 양식을 자동 생성하고 표시 여부를 확인합니다.
webiny-form-model
8.1k에이전트에게 선언형 필드 빌더, 레이아웃, 검증, 조건부 규칙으로 Webiny 양식을 만드는 법을 가르칩니다.
비슷한 스킬
api-connector-builder
280k에이전트가 기존 패턴을 따라 새로운 API 연결을 만들도록 합니다. 새로운 방식을 도입하지 않고 연동을 하나 더 추가할 때 씁니다.
api-design
280k에이전트가 모범 사례에 따라 REST API를 설계하도록 돕습니다. API가 통신하는 방식, 오류를 보여 주는 방식, 데이터를 정리하는 방식을 정하는 데 유용합니다.
backend-patterns
280k에이전트가 서버 쪽 아키텍처 패턴과 데이터베이스 최적화를 다루도록 돕습니다. 서버에서 실행되는 코드를 만들거나 검토할 때 유용합니다.