Problem exceuting custom actions

I get this error when my bot tries to run my custom action:

 DEBUG:rasa_core_sdk.executor:Received request to run 'action_saveSomething'
 ERROR:flask.app:Exception on /webhook [POST]** 
 
 Traceback (most recent call last):**
 
  File "/Users/ahson/Library/Python/2.7/lib/python/site-packages/rasa_core_sdk/executor.py", line 176, in run
     events = action(dispatcher, tracker, domain)
 
File "actions_custom.py", line 15, in run
     response =tracker.latest_message.text
 
 AttributeError: 'dict' object has no attribute 'text'
 
 127.0.0.1 - - [2018-09-10 12:16:27] "POST /webhook HTTP/1.1" 500 412 0.024237
 
 2018-09-10 12:16:27 DEBUG    urllib3.connectionpool  - http://localhost:5055 "POST /webhook HTTP/1.1" 500 291
 
 2018-09-10 12:16:27 ERROR    rasa_core.actions.action  - Failed to run custom action 'action_saveSomething'. Action server responded with a non 200 status code of 500. 
 
 Make sure your action server properly runs actions and returns a 200 once the action is executed. 
 
 Error: 500 Server Error: INTERNAL SERVER ERROR for url: http://localhost:5055/webhook

actions_custom.py:

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

from rasa_core_sdk import Action
from rasa_core_sdk.events import SlotSet

class ActionSaveSlot(Action):
    def name(self):
        return 'action_saveSomething'


    def run(self, dispatcher, tracker, domain):
        response =tracker.latest_message.text

        return [SlotSet("answer", response)]

Resolved,

        response =tracker.latest_message.text 

should be

        response =tracker.latest_message
1 Like

How are you running custom actions in 11.3 or above ? 10.4 was simpler . Can you simple give me short steps. any help is appreciated

@Abir - I wrote a bit about rasa core 0.11 and running an action server - i hope this helps you

The code is in github

Thanks a lot man :slight_smile: I went through your code , can you explain utter_template . I have used mostly utter_message and would love to know about the former one

1 Like