I would like to extract values from "alertType" and "sensorValue" and "startedAlerting" and send the value to MQTT. I know how to throw it to MQTT, but I am stuck around how get values out of text only from payloads.
You say you've shared a part of the payload - does that mean there's more to it then that?
What you've shared looks a lot like JSON, but its missing stuff at the start, so it isn't clear if you have a full valid piece of JSON or just some fragment.
Assuming its valid JSON, you can use the JSON node to parse the string to a JavaScript Object. Once you've done that, you'll be able to access the properties you want as msg.payload.body.alertType etc.