[This is incorrect. For some reason the AppleScript dictionary for Messages in the Script Editor Library was dimmed out in my Big Sur installation. However, after removing it and adding it back it is there, and after logging in the Messages with my iCloud account, I could successfully send an iMessage from Keyboard Maestro, so this was a false alarm - there are some other oddities, but the basic functionality works].
Just a note that as described on Daring Fireball, Apple has rewritten Messages in Big Sur as a Catalyst application, which does not support AppleScript.
If you rely on these actions, plan accordingly.