writing API function to update Elgg database from external app

I want to write an API to register user into Elgg database from an external website. Not sure where to start it. From webservices document, I figured out that I have to write new function which will add new user onto Elgg database and this new function need to be exposed using expose_function. The part I didn't get is where(which folder?) should I write this new function? Should it follow new plug-in directory structure? Do I have to register any event/action?

Thanks in advance for all help.

Beginning Developers

Beginning Developers

This space is for newcomers, who wish to build a new plugin or to customize an existing one to their liking