CA
like-gold
Is there a way to add a header the ad-hoc webhook?
One might suspect something like this should be possible:
await Actor.addWebhook({
eventTypes: ['ACTOR.RUN.SUCCEEDED'],
requestUrl: process.env.RUN_SUCCEEDED_WEBHOOK_URL,
idempotencyKey: process.env.APIFY_ACTOR_RUN_ID,
headers: {
'Authorization':
Bearer ${process.env.APIFY_API_TOKEN},
}
})
But it seems it's not possible at all? So we are supposed to add a secret to the URL I guess to add Authorization?3 Replies
Hi @Moby ,
Yes unfortunately, setting headers for the Webhook request is not currently possible.
You may use a workaroud by setting the webhook to run the Do Request Actor ( https://apify.com/useful-tools/do-request/input-schema ) Where you may set all necessary Headers to its input.
Apify
Input · Do Request · Apify
Simple Actor that does request based on the Actor's Input.
It allows to overcome issue with WebHooks not supporting to set request Headers.
like-goldOP•17mo ago
This would be a good feature to have. Basically any API that has authorization can not be used with webhooks directly rn
Hi @Moby ,
If you have any ideas regarding the feature to the Apify SDK it is always better to raise an Issue directly to the developers, than just discussing it there, I raised this one for you, so you may follow https://github.com/apify/apify-sdk-js/issues/275