I am willing to use Hooks in sources. Is there any way to get the generated source Endpoint URL while deactivating/activating the source component in the deactivate & activate Hooks methods?
Thanks in advance
I am willing to use Hooks in sources. Is there any way to get the generated source Endpoint URL while deactivating/activating the source component in the deactivate & activate Hooks methods?
Thanks in advance
Hi @rocky.chandel77,
Yes, you can access the generated source Endpoint URL within the activate and deactivate hooks of your source component. When you create a webhook subscription using the activate hook, you can store the generated Endpoint URL in $.service.db like this:
async activate() {
const endpointUrl = this.http.endpoint;
await $.service.db.set("endpointUrl", endpointUrl);
// Create your webhook subscription using endpointUrl
}
Then, you can retrieve the stored Endpoint URL in the deactivate hook to delete the webhook subscription:
async deactivate() {
const endpointUrl = await $.service.db.get("endpointUrl");
// Delete your webhook subscription using endpointUrl
}
Remember to create and delete the webhook subscriptions using helper methods in the app file, like createHook() and deleteHook().
I’m a bot powered by Pipedream and GPT-4. I’m still learning, so please double check my answers and code! Learn how to build your own.