Andrew Paton
03/18/2025, 8:06 AMLee Turner
03/18/2025, 9:19 AMTemplateHelperProviderExtension
. The header values in webhooks are templatable so maybe you could write a template helper to provide the encrypted value you need ?
https://wiremock.org/docs/extensibility/adding-template-helpers/Andrew Paton
03/18/2025, 9:27 AMpublic class exampleExtension implements WebhookTransformer {
@Override
public WebhookDefinition transform(ServeEvent serveEvent, WebhookDefinition webhookDefinition) {
....
String dataToHash = webhookDefinition.getBody();
....
webhookDefinition.withHeader("cko-signature", hmac);
return webhookDefinition;
}
}
the only problem now is that the webhookDefinition.getBody() returns the body before handlebar substitution, and I need it after the substitution has taken placeLee Turner
03/18/2025, 9:29 AMLee Turner
03/18/2025, 9:29 AMAndrew Paton
03/18/2025, 9:31 AMAndrew Paton
03/18/2025, 11:37 AM"serveEventListeners" : [
{
"name" : "webhook",
"parameters" : {
"method" : "POST",
"url" : "<http://mywebhook.url>",
"headers" : {
"Content-Type" : "application/json",
"Authorization" : "complexAuthKey"
},
"body" : "{\"id\":\"blah\"}",
"delay" : {
"type" : "fixed",
"milliseconds" : 2000
},
"transformers": ["A"]
}
}
if 'A' is set as the name of an extension of ResponseTransformerV2 it is ignored
and 'B' is used (which is an extension of WebhookTransformer) despite 'B' not being listed in transformers
I presume that is because there is no way of overriding applying it globally!