Trigger a custom action everytime a slot is filled

Hi, excuse me. I have a situation here. I have slot called “actual_conversation” that it fills with the last user input:

Slots:
  actual_conversation:
    type: text
    influence_conversation: false
    mappings:
    - type: from_text

And I have a custom action with a sentiment analysis that I want to perform with the slot “actual_conversation” previously filled.

class ActionSentimentAnalysis(Action):

    def name(self) -> Text:
        return "action_sentiment_analysis"

    def run(self, dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
        
        actual_conversation = tracker.get_slot("actual_conversation")
        analyzer = create_analyzer(task="sentiment", lang="es")
        print(actual_conversation)
        print(analyzer.predict(actual_conversation))
        
        dispatcher.utter_message(text = "Lamento no haberte sido de ayuda")
        return [ConversationPaused()]

I want to run the above custom action every time the slot “actual_conversation” is filled (in simple terms, everytime the user send an input). The main idea is to received the user input to perform a sentiment analysis on it.

But I can’t find a way to trigger the custom action everytime the slot is filled, is there any way to achieve this?

You should look at writing a custom component. There’s a blog post on writing one that uses sentiment analysis as the example here.