FTP script needs changing to SFTP

-- Copyright (c) 2004 David Kocher. All rights reserved.
-- http://cyberduck.ch/
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 2 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- Bug fixes, suggestions and comments should be sent to:
-- dkocher@cyberduck.ch

on adding folder items to this_folder after receiving added_items
   set theServer to "example.net"
   set theUser to "username"
   set theProtocol to "ftp"
   set theUploadFolder to "upload"
   
   set the item_count to the number of items in the added_items
   if the item_count is greater than 0 then
       with timeout of 300 seconds
           tell application "Cyberduck"
               set theBrowser to (make new browser)
               tell (theBrowser)
                   set encoding to "UTF-8"
                   connect to theServer with protocol theProtocol as user theUser with initial folder theUploadFolder
                   repeat with theFile in added_items
                       upload item theFile
                   end repeat
                   disconnect
               end tell
           end tell
       end timeout
   end if
end adding folder items to

i was using this script, which worked perfectly. then i disabled FTP on my server and started using SFTP for security. i can still get access to the server with the cyberduck client but the script no longer works. i did change this to see if it would work but it doesn’t:

   set theProtocol to "sftp"

any ideas? thanks