Why looping getShapes() writes nothing
The first time I ran a shapes loop expecting to find speaker notes, nothing failed — the loop just silently touched zero notes. Speaker notes are not a shape on the slide canvas. They live on a completely separate object: a NotesPage, one per slide, accessible only through slide.getNotesPage(). Calling getShapes() on the slide itself will never return the notes shape because that shape does not exist in the slide's shape collection.
Once you have the NotesPage, you still need one more step: call getSpeakerNotesShape() on it. That returns the single TextItem-bearing shape that Slides reserves for speaker notes. From there, getText().setText() works exactly as it does on any other text shape. The full path is: slide → getNotesPage() → getSpeakerNotesShape() → getText() → setText().