I have a template for this request saved as a JSON project file:
It doesn't have to be a file, you can simply store this JSON string in a text variable. Then to replace session ID use:
Set jsonString to replace(jsonString, "YOUR_SESSION_ID", extractedSessionID)
Another option is to load (parse) it into JSON object and use this action:
JSON Set value at "transport.session_id" to extractedSessionID
Then how do I format this so that I can use it in the data parameter of the AJAX request?
This should be in Twitch documentation I suppose. If you are using JSON object, you can convert it back to string with JSON.ToCompactString expression.