How to append free text to a slot instead of overwriting it?

Hi all, I was wondering how to append things to a slot as opposed to overwriting it? I’m using a custom action to get the text from the last user message and I’d like to append that to a single slot, see below.

class ActionStoreIntentMessage(Action):

    def name(self):

        return "action_store_intent_message"

    def run(self, dispatcher, tracker, domain):

        message = tracker.latest_message.get('text')

        return [SlotSet('intent_message', message)]

actions.py (489 Bytes)

Hi @Samuel

Welcome to Rasa Community !

You can do like this:

    message = tracker.latest_message['text']
    prevmessage = tracker.get_slot('intent_message')

    if prevmessage is not None:
       message = message+prevmessage

    return [SlotSet('intent_message', message)]

Great! it works. Thank you :slight_smile: