Hi Lukas,
Thanks for posting your concern.
Upon checking the code, I observed 2 things in your code. Please see the following:
1.) The return values for the matchType field is capital letters. You may try to change the values you've set in the condition by changing the text cases into capital case.
2.) Assuming that one of the condition is satisfied. However, you are setting the same match type to a certain keyword. For example, the condition for keyword with broad match type is satisfied, however, the code will still set BROAD value to the keyword.
Please modify the code based on the provided observation and let me know if the issue persists.
Regards,
Ejay
Google Ads API Team