Custom keyboard events

It looks like a custom keyboard created through an UIInputViewController doesn't have access to all events. How can one know inside a messaging App that the Send button was tapped? And how does one know what text was sent and text was not sent when the keyboard is closed? Is this a privacy policy or is there an API I am missing?

Custom keyboard events
 
 
Q