So this Profile will start a messaging app when you open the physical keyboard if the screen was off.
It will disable the keyguard and load the app, but only if the screen was off when the keyboard was opened.

State: Keyboard Out

Enter Task:

Variable Set %SCREENWAS to 'off if %SCREEN ~(matches) 'off'

Keyguard Set 'off' if %SCREENWAS ~(matches) 'off'

Load App [whatever app name here] if %SCREENWAS ~(matches) 'off'

Variable Clear %SCREENWAS

Exit Task:

Keyguard Set 'on'

I'm not sure why this works, but Tasker reads the variable %SCREEN as off, if it was before the keyboard opened.