소스 정보
- 저장소
- simstudioai/sim
- 최근 소스 활동
- 2026년 7월 13일 23:12
- 감지된 SKILL.md 언어
- 영어
- 스타
- 29,424
- 포크
- 3,775
설치 방법
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
소스 파일 검토
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
메뉴
기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.
설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/simstudioai/sim --skill add-trigger명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
The response, error, pagination, and validation contract every `/api/v2` endpoint must satisfy. Use when adding or changing a route under `apps/sim/app/api/v2/`, or when auditing one for conformance.
Commit, push, and open a PR to staging in one shot — runs the cleanup pass and, when migrations changed, the db-migrate safety review first
Keep the executable tool registry out of client-reachable module graphs — when to read `@/tools/metadata` instead of `getTool`, how to measure whether an import edge pulls the registry, and how to regenerate the metadata artifacts. Use when touching `apps/sim/tools/registry.ts`, `tools/utils.ts`, `tools/params.ts`, or anything that calls `getTool`.
SOC 직업 분류 기준
SKILL.md 표시 중
| name | add-trigger |
| description | Create webhook or polling triggers for a Sim integration |
| argument-hint | <service-name> |
You are an expert at creating webhook and polling triggers for Sim. You understand the trigger system, the generic buildTriggerSubBlocks helper, polling infrastructure, and how triggers connect to blocks.
If the service docs do not clearly show the webhook payload JSON for an event, you MUST tell the user instead of guessing trigger outputs or formatInput mappings.
formatInput against unverified webhook bodiesIf the payload shape is unknown, do one of these instead:
apps/sim/triggers/{service}/
├── index.ts # Barrel exports
├── utils.ts # Service-specific helpers (options, instructions, extra fields, outputs)
├── {event_a}.ts # Primary trigger (includes dropdown)
├── {event_b}.ts # Secondary trigger (no dropdown)
└── webhook.ts # Generic webhook trigger (optional, for "all events")
apps/sim/lib/webhooks/
├── provider-subscription-utils.ts # Shared subscription helpers (getProviderConfig, getNotificationUrl)
├── providers/
│ ├── {service}.ts # Provider handler (auth, formatInput, matchEvent, subscriptions)
│ ├── types.ts # WebhookProviderHandler interface
│ ├── utils.ts # Shared helpers (createHmacVerifier, verifyTokenAuth, skipByEventTypes)
│ └── registry.ts # Handler map + default handler
utils.tsThis file contains all service-specific helpers used by triggers.
import type { SubBlockConfig } from '@/blocks/types'
import type { TriggerOutput } from '@/triggers/types'
export const {service}TriggerOptions = [
{ label: 'Event A', id: '{service}_event_a' },
{ label: 'Event B', id: '{service}_event_b' },
]
export function {service}SetupInstructions(eventType: string): string {
const instructions = [
'Copy the <strong>Webhook URL</strong> above',
'Go to <strong>{Service} Settings > Webhooks</strong>',
`Select the <strong>${eventType}</strong> event type`,
'Paste the webhook URL and save',
'Click "Save" above to activate your trigger',
]
return instructions
.map((instruction, index) =>
`<div class="mb-3"><strong>${index + 1}.</strong> ${instruction}</div>`
)
.join('')
}
export function build{Service}ExtraFields(triggerId: ): [] {
[
{
: ,
: ,
: ,
: ,
: ,
: { : , : triggerId },
},
]
}
build{}(): <, > {
{
: { : , : },
: { : , : },
: {
: { : , : },
: { : , : },
},
}
}
Primary trigger — MUST include includeDropdown: true:
import { {Service}Icon } from '@/components/icons'
import { buildTriggerSubBlocks } from '@/triggers'
import { build{Service}ExtraFields, build{Service}Outputs, {service}SetupInstructions, {service}TriggerOptions } from '@/triggers/{service}/utils'
import type { TriggerConfig } from '@/triggers/types'
export const {service}EventATrigger: TriggerConfig = {
id: '{service}_event_a',
name: '{Service} Event A',
provider: '{service}',
description: 'Trigger workflow when Event A occurs',
version: '1.0.0',
icon: {Service}Icon,
subBlocks: buildTriggerSubBlocks({
triggerId: '{service}_event_a',
triggerOptions: {service}TriggerOptions,
includeDropdown: true,
setupInstructions: {service}SetupInstructions('Event A'),
: build{}(),
}),
: build{}(),
: { : , : { : } },
}
Secondary triggers — NO includeDropdown (it's already in the primary):
export const {service}EventBTrigger: TriggerConfig = {
// Same as above but: id: '{service}_event_b', no includeDropdown
}
apps/sim/triggers/{service}/index.tsexport { {service}EventATrigger } from './event_a'
export { {service}EventBTrigger } from './event_b'
apps/sim/triggers/registry.tsimport { {service}EventATrigger, {service}EventBTrigger } from '@/triggers/{service}'
export const TRIGGER_REGISTRY: TriggerRegistry = {
// ... existing ...
{service}_event_a: {service}EventATrigger,
{service}_event_b: {service}EventBTrigger,
}
apps/sim/blocks/blocks/{service}.ts)Wire triggers into the block so the trigger UI appears and generate-docs.ts discovers them. Two changes are needed:
subBlocks arraytriggers property after outputs with enabled: true and available: [...]import { getTrigger } from '@/triggers'
export const {Service}Block: BlockConfig = {
// ...
subBlocks: [
// Regular tool subBlocks first...
...getTrigger('{service}_event_a').subBlocks,
...getTrigger('{service}_event_b').subBlocks,
],
// ... tools, inputs, outputs ...
triggers: {
enabled: true,
available: ['{service}_event_a', '{service}_event_b'],
},
}
Versioned blocks (V1 + V2): Many integrations have a hidden V1 block and a visible V2 block. Where you add the trigger wiring depends on how V2 inherits from V1:
...V1Block spread (e.g., Google Calendar): Add trigger to V1 — V2 inherits both subBlocks and triggers automatically.subBlocks (e.g., Google Sheets): Add trigger to V2 (the visible block). V1 is hidden and doesn't need it.generate-docs.ts deduplicates by base type (first match wins). If V1 is processed first without triggers, the V2 triggers won't appear in integrations.json. Always verify by checking the output after running the script.
All provider-specific webhook logic lives in a single handler file: apps/sim/lib/webhooks/providers/{service}.ts.
| Behavior | Method | Examples |
|---|---|---|
| HMAC signature auth | verifyAuth via createHmacVerifier | Ashby, Jira, Linear, Typeform |
| Custom token auth | verifyAuth via verifyTokenAuth | Generic, Google Forms |
| Event filtering | matchEvent | GitHub, Jira, Attio, HubSpot |
| Idempotency dedup | extractIdempotencyId | Slack, Stripe, Linear, Jira |
| Custom input formatting | formatInput | Slack, Teams, Attio, Ashby |
| Auto webhook creation | createSubscription | Ashby, Grain, Calendly, Airtable |
| Auto webhook deletion | deleteSubscription | Ashby, Grain, Calendly, Airtable |
| Challenge/verification | handleChallenge | Slack, WhatsApp, Teams |
| Custom success response | formatSuccessResponse | Slack, Twilio Voice, Teams |
If none apply, you don't need a handler. The default handler provides bearer token auth.
import crypto from 'crypto'
import { createLogger } from '@sim/logger'
import { safeCompare } from '@/lib/core/security/encryption'
import type { EventMatchContext, FormatInputContext, FormatInputResult, WebhookProviderHandler } from '@/lib/webhooks/providers/types'
import { createHmacVerifier } from '@/lib/webhooks/providers/utils'
const logger = createLogger('WebhookProvider:{Service}')
function validate{Service}Signature(secret: string, signature: string, body: string): boolean {
if (!secret || !signature || !body) return false
const computed = crypto.createHmac('sha256', secret).update(body, 'utf8').digest('hex')
return safeCompare(computed, signature)
}
export const {service}Handler: WebhookProviderHandler = {
: ({
: ,
: ,
: validate{},
: ,
}),
() {
triggerId = providerConfig. |
(triggerId && triggerId !== ) {
{ is{} } = ()
(!is{}(triggerId, body <, >))
}
},
({ body }: ): <> {
b = body <, >
{
: {
: b.,
: (b. <, >)?. || ,
: b.,
},
}
},
() {
obj = body <, >
obj. && obj. ? :
},
}
In apps/sim/lib/webhooks/providers/registry.ts:
import { {service}Handler } from '@/lib/webhooks/providers/{service}'
const PROVIDER_HANDLERS: Record<string, WebhookProviderHandler> = {
// ... existing (alphabetical) ...
{service}: {service}Handler,
}
There are two sources of truth that MUST be aligned:
outputs — schema defining what fields SHOULD be available (UI tag dropdown)formatInput on the handler — implementation that transforms raw payload into actual dataIf they differ: the tag dropdown shows fields that don't exist, or actual data has fields users can't discover.
Rules for formatInput:
{ input: { ... } } where inner keys match trigger outputs exactly{ input: ..., skip: { message: '...' } } to skip executionnull for missing optional dataIf the service API supports programmatic webhook creation, implement createSubscription and deleteSubscription on the handler. The orchestration layer calls these automatically — no code touches route.ts, provider-subscriptions.ts, or deploy.ts.
import { getNotificationUrl, getProviderConfig } from '@/lib/webhooks/provider-subscription-utils'
import type { DeleteSubscriptionContext, SubscriptionContext, SubscriptionResult } from '@/lib/webhooks/providers/types'
export const {service}Handler: WebhookProviderHandler = {
async createSubscription(ctx: SubscriptionContext): Promise<SubscriptionResult | undefined> {
const config = getProviderConfig(ctx.webhook)
const apiKey = config.apiKey as string
if (!apiKey) throw new Error('{Service} API Key is required.')
const res = await fetch('https://api.{service}.com/webhooks', {
method: 'POST',
headers: { Authorization: `Bearer ${apiKey}`, 'Content-Type': 'application/json' },
body: JSON.stringify({ url: (ctx.) }),
})
(!res.) ()
{ id } = ( res.()) { : }
{ : { : id } }
},
(: ): <> {
config = (ctx.)
{ apiKey, externalId } = config { ?: ; ?: }
(!apiKey || !externalId)
(, {
: ,
: { : },
}).( {})
},
}
Key points:
createSubscription — orchestration rolls back the DB webhookdeleteSubscription — log non-fatally{ providerConfigUpdates: { externalId } } — orchestration merges into providerConfigapiKey field to build{Service}ExtraFields with password: trueTrigger outputs use the same schema as block outputs (NOT tool outputs).
Supported: type + description for leaf fields, nested objects for complex data.
NOT supported: optional: true, items (those are tool-output-only features).
export function buildOutputs(): Record<string, TriggerOutput> {
return {
eventType: { type: 'string', description: 'Event type' },
timestamp: { type: 'string', description: 'When it occurred' },
payload: { type: 'json', description: 'Full event payload' },
resource: {
id: { type: 'string', description: 'Resource ID' },
name: { type: 'string', description: 'Resource name' },
},
}
}
Use polling when the service lacks reliable webhooks (e.g., Google Sheets, Google Drive, Google Calendar, Gmail, RSS, IMAP). Polling triggers do NOT use buildTriggerSubBlocks — they define subBlocks manually.
apps/sim/triggers/{service}/
├── index.ts # Barrel export
└── poller.ts # TriggerConfig with polling: true
apps/sim/lib/webhooks/polling/
└── {service}.ts # PollingProviderHandler implementation
apps/sim/lib/webhooks/polling/{service}.ts)import { pollingIdempotency } from '@/lib/core/idempotency/service'
import type { PollingProviderHandler, PollWebhookContext } from '@/lib/webhooks/polling/types'
import { markWebhookFailed, markWebhookSuccess, resolveOAuthCredential, updateWebhookProviderConfig } from '@/lib/webhooks/polling/utils'
import { processPolledWebhookEvent } from '@/lib/webhooks/processor'
export const {service}PollingHandler: PollingProviderHandler = {
provider: '{service}',
label: '{Service}',
async pollWebhook(ctx: PollWebhookContext): Promise<'success' | 'failure'> {
const { webhookData, workflowData, requestId, logger } = ctx
const webhookId = webhookData.id
try {
// For OAuth services:
const accessToken = await resolveOAuthCredential(webhookData, '{service}', requestId)
const config = webhookData.providerConfig as unknown as {Service}WebhookConfig
// First poll: seed state, emit nothing
(!config.) {
(webhookId, { : ().() }, logger)
(webhookId, logger)
}
(webhookId, logger)
} (error) {
logger.(, error)
(webhookId, logger)
}
},
}
Key patterns:
pollingIdempotency.executeWithIdempotency(provider, key, callback) for dedupprocessPolledWebhookEvent(webhookData, workflowData, payload, requestId) to fire the workflowupdateWebhookProviderConfig(webhookId, partialConfig, logger) for read-merge-write on stateapps/sim/triggers/{service}/poller.ts)import { {Service}Icon } from '@/components/icons'
import type { TriggerConfig } from '@/triggers/types'
export const {service}PollingTrigger: TriggerConfig = {
id: '{service}_poller',
name: '{Service} Trigger',
provider: '{service}',
description: 'Triggers when ...',
version: '1.0.0',
icon: {Service}Icon,
polling: true, // REQUIRED — routes to polling infrastructure
subBlocks: [
{ id: 'triggerCredentials', type: 'oauth-input', title: 'Credentials', serviceId: '{service}', requiredScopes: [], required: true, mode: 'trigger' },
// ... service-specific config fields (dropdowns, inputs, switches) ...
{ id: 'triggerInstructions', type: 'text', title: 'Setup Instructions', hideFromPreview: , : , : },
],
: {
},
}
apps/sim/triggers/constants.ts — add provider to POLLING_PROVIDERS Setapps/sim/lib/webhooks/polling/registry.ts — import handler, add to POLLING_HANDLERSapps/sim/triggers/registry.ts — import trigger config, add to TRIGGER_REGISTRYAdd to helm/sim/values.yaml under the existing polling cron jobs:
{service}WebhookPoll:
schedule: "*/1 * * * *"
concurrencyPolicy: Forbid
url: "http://sim:3000/api/webhooks/poll/{service}"
apps/sim/lib/webhooks/polling/rss.ts + apps/sim/triggers/rss/poller.tsapps/sim/lib/webhooks/polling/gmail.ts + apps/sim/triggers/gmail/poller.tsapps/sim/lib/webhooks/polling/google-drive.tsapps/sim/lib/webhooks/polling/google-calendar.tsutils.ts with options, instructions, extra fields, and output buildersincludeDropdown: true; secondary triggers do NOTbuildTriggerSubBlocks helperindex.ts barrel exporttriggers/registry.ts → TRIGGER_REGISTRYtriggers.enabled: true and lists all trigger IDs in triggers.available...getTrigger('id').subBlocksapps/sim/lib/webhooks/providers/{service}.tsproviders/registry.ts (alphabetical)formatInput output keys match trigger outputs exactlyawait import() for trigger utilscreateSubscription and deleteSubscription on the handlerroute.ts, provider-subscriptions.ts, or deploy.tspassword: truePollingProviderHandler at lib/webhooks/polling/{service}.tspolling: true and defines subBlocks manually (no buildTriggerSubBlocks)POLLING_PROVIDERS, polling registryPOLLING_PROVIDERS in triggers/constants.tsPOLLING_HANDLERS in lib/webhooks/polling/registry.tshelm/sim/values.yamloutputs schemabun run type-check passesoutputs keys