Can a user invite other users programatically?

Hi,

Here is a thread that might help you (maybe not entirely, the flow might be updated to your specific use case)