Kong Request Transformation: How to fetch path and add them to request body?

Here’s what I’m trying to do: We have configured a route with path /events for users to send events.

We have a URL structure defined /events/{sender}/{category}/{type}

with custom header `custom_header_name":“custom_header_value”

and any request payload; for simplicity’s sake let’s assume it to be {“test_key”:“test_value”}

I want to perform a Request Transformation where I can fetch the data from the URL, headers and existing body to create a new body as shown:

  "method": "POST",

Is this possible with the request-transformer or request-transformer-advanced plugins ? If yes, then can someone give me an example? Or I gotta build a one?

While we’re at it, are we able to Base-64 encode the actual body and set it as a Base-64 encoded string?