Auto-Resolution Change for MBP

I’m getting a new MBP and I want to use it as secondary monitor, but I like the resolution lower when plugged in and higher when in “portable mode”. Is there a way to automate resolution switching when plugging in an external monitor or maybe even hot keys? I can’t see a way to do it in Shortcuts or Keyboard Maestro.

There’s a utility called SwitchResX does that for $16. There’re cheaper alternatives but in terms of stability and longevity SwitchResX is the best; absolutely worth the price.