Totally do-able... That's what I've done with my MX Master 2S.
-
You need the Logitech Options software: https://www.logitech.com/en-us/product/options
-
Install that, then click on the button and select "Keystroke Assignment"
-
Assign a shortcut from BTT and you're in business. Here's a screenshot of mine.