(ctx: PollWebhookContext)
| 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 | |
| 208 | async function pollSearchBased( |
nothing calls this directly
no test coverage detected