MCPcopy Index your code
hub / github.com/simstudioai/sim / pollWebhook

Function pollWebhook

apps/sim/lib/webhooks/polling/hubspot.ts:188–205  ·  view source on GitHub ↗
(ctx: PollWebhookContext)

Source from the content-addressed store, hash-verified

186 label: 'HubSpot',
187
188 async pollWebhook(ctx: PollWebhookContext): Promise<'success' | 'failure'> {
189 const { webhookData, requestId, logger } = ctx
190 const webhookId = webhookData.id
191
192 try {
193 const accessToken = await resolveOAuthCredential(webhookData, 'hubspot', requestId, logger)
194 const config = getProviderConfig<HubSpotWebhookConfig>(webhookData.providerConfig)
195
196 if (config.objectType === 'list_membership') {
197 return await pollListMembership(ctx, config, accessToken)
198 }
199 return await pollSearchBased(ctx, config, accessToken)
200 } catch (error) {
201 logger.error(`[${requestId}] Error processing HubSpot webhook ${webhookId}:`, error)
202 await markWebhookFailed(webhookId, logger)
203 return 'failure'
204 }
205 },
206}
207
208async function pollSearchBased(

Callers

nothing calls this directly

Calls 6

resolveOAuthCredentialFunction · 0.90
getProviderConfigFunction · 0.90
markWebhookFailedFunction · 0.90
pollListMembershipFunction · 0.85
pollSearchBasedFunction · 0.85
errorMethod · 0.80

Tested by

no test coverage detected