has anyone worked with using a generic web cloud h...
# ask-community
s
has anyone worked with using a generic web cloud hook before? I'd like to configure the JSON payload that gets sent to the provided URL but it doesn't seem like there's a way to do that just by looking at the cloud interface?
n
Hi @Sean Talia - this isn't something that's configurable at the moment; out of curiosity, what sort of data are you hoping to add to the payload?
s
ah okay – I was trying to set up a hook to hit a REST endpoint for Splunk On Call, so that when certain flows fail my team gets an on call alert; Splunk requires a
message_type
field and then recommends a few additional ones (as per this guide )
sadly we moved off of pager duty so i can't use the native hook you have for that 😞
n
Ahh I see; one way you could work around this would be to add a task to your flow that has an upstream failed trigger that would send the payload you're looking for
z
I'm taking ownership of cloud hooks and I'll investigate if there's a good way for us to do this in the future.
s
@nicholas do you think that's a better approach than setting up a state handler to slap onto the flow? i'm envisioning the state handler just sending a curl request to that endpoint
i feel like that's cleaner than creating a like, synthetic leaf node that doesn't really belong in the flow's DAG just to capture failures on any upstream task...but maybe that's not what they're intended for? i haven't used one yet
n
I think either approach would work; a state handler would be better if you prefer not to see your notification task as part of the flow's schematic and a task would better if you would.
👍 1
s
alright cool, thank you both, this prevented me from embarking on a fool's errand
😄 1
@Zanie can I fill out a formal feature request or something for this? I think this would be really valuable; the Slack integration took me like 20 minutes to get up and running, if I could have configured the payload and gotten this VictorOps integration going in the same amount of time that would have been amazing
does the community ever author state handlers? I think that's probably what I'm going to end up doing, I'd be happy to submit a PR for a VictorOps state handler for others to use
z
No need for a formal request, I've already created a branch in the backend to explore it
👍 1
I don't think we've received any community state handlers yet, I'll check in with the team to see how we fill about expanding the out-of-the-box state handlers.
Happy to say this is merged into our dev environment 🙂 it may be a bit before it's available since it's rolled into a larger feature set but I'm excited to share haha
s
ha nice! I also just successfully set up a victorops state handler for my org about 10 minutes ago, it was super easy to do it that way well
z
Yeah state handlers are really powerful for that!
s
on this subject; is it possible to add additional parameters to the state handler's function signature? (e.g.
def handler(old, old_state, new_state, extra_param)
)
z
How would the param be filled?
s
well okay maybe i should rephrase my question; is there a way to pass additional data to the handler at the time that I attach it to a flow/task? I'd like to be able to pass in parameters that would define 1) the severity of the incident 2) the team at my org that needs to be notified of the flow/task failure
z
You could use functools.partial
s
wow never heard of this, thanks for the tip...I ended up just making a class that will define a handler that makes a request to the appropriate endpoint based on a specific instance var, but that's a good tip!