convoy
convoy copied to clipboard
[Feature request]: Add templating functionality for custom response
First of all, thank you for effort to build this great product.
Is your feature request related to a problem? Please describe.
I want to solve okta's one-time verification request (https://developer.okta.com/docs/concepts/event-hooks/#one-time-verification-request) using convoy, but the challenge requires to respond with header value (x-okta-verification-challenge).
Describe the solution you'd like
Add templating functionality just like helm does. It's known to be using golang's template package (https://pkg.go.dev/text/template). It is likely to be easy to integrate and could be familiar to users.
Describe alternatives you've considered
There is a lot of template engines such as mustache, and I think it has simpler grammar.
Additional context
Okta requests with GET method for that challenge. Is it possible to support GET methods too?
Hey @qbx2,
This is an interesting problem. We do something like this when specifying idempotency for incoming projects.
Is this what you had in mind? Something like this?
{{ req.body.name}}, {{ req.header.x-convoy-version}}
var buf bytes.Buffer
tpl, err := template.New("file").Parse(templateFile)
if err != nil {
return err
}
err = tpl.Execute(&buf, request)
if err != nil {
return err
}
This change would require frontend changes, hmm. I think that's all
Also, would you be willing to open a PR for this?
@jirevwe Yes, that's correct. I'm sorry, but I'm busy with other work, so it won't be possible to submit a PR for the time being.
That's fine. We'd open a PR and link it to this issue.
Wow, that's so fast!! I just want to double-check that you didn't forget to support GET method to solve Okta's challenge.
Hi, I'm planning on using convoy but I'm currently stuck by this (mine is slack validation challenge). Does anything has been made to authorize custom body response yet ? Thanks a lot