How can we pass predefined variable instead of rasa input, fetch intent in a variable?

Our rasa chatbot currently asks for user input in the rasa shell. Is it possible to send user input as a variable parameter through a function that returns the type of intent? I would like to write a python function to do this like so

def get_intent(user_input):
    #code to send this input for rasa intent classification
    return intent #greeting,affirmation,....

How could we do this?