Dismiss keyboard in custom push notification UI

In my custom UI for a push notification I have three buttons, one of which is a UNTextInputNotificationAction, which pops up the keyboard. In the didReceive(_:completionHandler:) method I'm calling the completionHandler with .doNotDismiss because they might push more than one button or make a comment. However, if the first thing they click is the button for the keyboard, and then I hit Send, the keyboard still stays on the screen.


How do I make the keyboard go away so the action buttons are visible again but not dismiss the entire notification?