There's also a lot more that can be done, especially with the credentials... storing them as an encrypted file and retrieving them for the function (function just for that, functions using other functions), keeping all the parameter data in an object to retrieve, or from CSV, etc....

It depends on how far down the rabbit hole you want to go, and how much time you want to spend making it.

Honestly, I'd do this kind of thing with a different project, but this can work too. There's a lot you can do.