Add a user to a group via API?

This script will create a user and optionally add it to a group:

https://github.com/pfaffman/discourse-user-creator