External API call with access token retrieved from user's input

Hello, I have custom actions that call an external API. This API call is specific for every user and it needs in his headers an access token. I tried to send the access token as a normal user’s input but the Rasa nlu didn’t recognize what intent belongs to and of course the Rasa core couldn’t predict the action. I was thinking also to add a variable besides the user’s message and save my access token in it but when I investigated the Rasa core implementation I found that’s can’t be done. Is there any solution for this issue.

Hi there @mounabenayed, I agree, I don’t think it’s possible yet – would a metadata field within UserMessage where you could store that token solve your problem?

Sure, but I have to pass it to my custom action without any modification, can you give me an example of how can I do it ?

I don’t know if I could right now – like I said, I don’t think there’s currently a way to do this, as the fields within UserMessage are currently the only information passed through the input channel. The reason I ask is because we plan to add a metadata field or something of the sort as part of an IO refactor we’re working on. Sorry I can’t help with your immediate problem.

Thank you @erohmensing for your response. Adding such a functionality would be so beneficial and would enhance the capability of Rasa. Great job thinking developing it.