convoy icon indicating copy to clipboard operation
convoy copied to clipboard

[Feature request]: Add templating functionality for custom response

Open qbx2 opened this issue 11 months ago • 6 comments

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?

qbx2 avatar Mar 08 '24 07:03 qbx2

Hey @qbx2,

This is an interesting problem. We do something like this when specifying idempotency for incoming projects. Screenshot 2024-03-09 at 15 07 16

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 avatar Mar 09 '24 14:03 jirevwe

@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.

qbx2 avatar Mar 12 '24 03:03 qbx2

That's fine. We'd open a PR and link it to this issue.

jirevwe avatar Mar 12 '24 07:03 jirevwe

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.

qbx2 avatar Mar 13 '24 12:03 qbx2

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

IntraMail avatar Sep 16 '24 15:09 IntraMail