Are 2.0 docs obsolete for customising 'action_session_start'?

I’m using Rasa 2.0, and have an actions server set up with a custom action working correctly.

I wanted to try customising the action_session_start action, however, using the code in the docs (Default Actions) I get an error about EventType being undefined.

Suggested code:

from typing import Text, List, Dict, Any

from rasa_sdk import Action, Tracker
from rasa_sdk.events import SlotSet, SessionStarted, ActionExecuted, EventType
from rasa_sdk.executor import CollectingDispatcher


class ActionSessionStart(Action):
    def name(self) -> Text:
        return "action_session_start"

    @staticmethod
    def fetch_slots(tracker: Tracker) -> List[EventType]:
        """Collect slots that contain the user's name and phone number."""

        slots = []

        for key in ("name", "phone_number"):
            value = tracker.get_slot(key)
            if value is not None:
                slots.append(SlotSet(key=key, value=value))

        return slots

    async def run(
        self,
        output_channel: "OutputChannel",
        nlg: "NaturalLanguageGenerator",
        tracker: "DialogueStateTracker",
        domain: "Domain",
    ) -> List[Event]:

        # the session should begin with a `session_started` event
        events = [SessionStarted(metadata=self.metadata)]

        # any slots that should be carried over should come after the
        # `session_started` event
        events.extend(self.fetch_slots(tracker))

        # an `action_listen` should be added at the end as a user message follows
        events.append(ActionExecuted("action_listen"))

        return events

I see it’s not importing Event. In other custom action examples it uses EventType in the list so I’m assuming this is a mistake? Once I changed Event to EventType I got a new error:

TypeError: run() missing 1 required positional argument: 'domain'

I see that in the earlier code example on the same page (the one for ActionRestart), run only gets passed 4 arguments instead of 5:

class ActionRestart(Action):

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

  async def run(
      self, dispatcher, tracker: Tracker, domain: Dict[Text, Any]
  ) -> List[Dict[Text, Any]]:

      # custom behavior

      return [...]

I copied this method definition I got a new error:

Traceback (most recent call last):
  File "/opt/venv/lib/python3.7/site-packages/sanic/app.py", line 973, in handle_request
    response = await response
  File "/opt/venv/lib/python3.7/site-packages/rasa_sdk/endpoint.py", line 102, in webhook
    result = await executor.run(action_call)
  File "/opt/venv/lib/python3.7/site-packages/rasa_sdk/executor.py", line 390, in run
    events = await action(dispatcher, tracker, domain)
  File "/app/actions/actions.py", line 73, in run
    events = [SessionStarted(metadata=self.metadata)]
AttributeError: 'ActionSessionStart' object has no attribute 'metadata'

At this point I’m sure I must have missed something huge, or the docs are for a different version. Can anyone confirm?

This is the version that I got working for me:

class ActionSessionStart(Action):
    def name(self) -> Text:
        return "action_session_start"

    @staticmethod
    def fetch_slots(tracker: Tracker) -> List[EventType]:
        """Collect slots that contain the user's name and phone number."""

        slots = []
        logger.info("keeping only name/phone_number slots")
        for key in ("name", "phone_number"):
            value = tracker.get_slot(key)
            if value is not None:
                slots.append(SlotSet(key=key, value=value))
        return slots

    async def run(
      self, dispatcher, tracker: Tracker, domain: Dict[Text, Any]
    ) -> List[Dict[Text, Any]]:
        # the session should begin with a `session_started` event
        events = [SessionStarted()]

        # any slots that should be carried over should come after the
        # `session_started` event
        events.extend(self.fetch_slots(tracker))

        # an `action_listen` should be added at the end as a user message follows
        events.append(ActionExecuted("action_listen"))

        return events

Edit: I have suggested this as an improvement in this github issue: Update action_session_start customisation code sample in Default Actions docs · Issue #7094 · RasaHQ/rasa · GitHub