Welcome to the forum!
Where are you trying this code? Can you explain the reasoning behind it?
You can send info from a channel to Rasa with a method similar to what I described here: Different response for each users types - #6 by ChrisRahme
Also, in a Custom Action, all the info you can have about the state of the conversation on Rasa’s side is stored in the tracker
variable.