What’s your idea?
Webhooks and (possibly tasks) should be able to invoke a task function.
What problem might it solve?
I have multiple tasks I need to duplicate as resolvers to do basic functionality.
For example, I have 2 tasks that adds/removes emails from my mailing list (Sendgrid). These are great as I can add a user to my “Subscribers” mailing list when they sign up via. a Trigger that already runs.
Naturally when a user cancels. their subscription I want to remove them from that mailing list so they don’t get spammed.
I use Stripe (Probably the most popular online payment system) and the way I know a customer is canceled successfully is via. their subscription.deleted webhook.
So it makes sense for me that when I receive a webhook that confirms the user has canceled I want to invoke my task that removes them from my mailing list.
After building all of this. I just get an error that ctx.invokeFunction doesn’t exist when using webhooks
I feel like this would add a lot more re-usability of code if I could re-use task functions anywhere and not just Triggers and Resolvers.
Right now I have to duplicate my task code to a Resolver and manually make a graphQL request to the resolver to run the exact same thing as I have a task for already…
I do not want to move my task to just always be a resolver as I can re-use the task easier in my Trigger and Resolver functions.
Any ideas on how you think it could/should work?
Add the ctx.invokeFunction you already have available in Triggers and Resolvers to Webhook functions