Yes, you are on exactly the right track. Groups each with its own key saves a lot of setup work, and by having two self-enrollment methods, one for each group, you get both an individualized message and the group memberships assigned
Make sure to give the users the GROUP enrollment key set when you create/edit the group. Do NOT give them the main enrollment key to the enrollment method. In fact, you can make the main key some random string that can't be guessed.
Why? Because if they enrol using the main key instead of the group key, they will not be put in the proper group ;)
That's a problem because it is hard to spot. They will be properly enrolled otherwise, and probably won't notice this is incorrect until down the road when they are working in the course and things are awry due to the group assignments.
So, for example, this type of configuration is what I use:
- Custom self-enrollment name: Morning Group Enroll Here
- Enrollment key: XhdiEhjqna72d9
- Group name: Morning
- Group enrollment key: Secret123
- Custom self-enrollment name: Afternoon Group Enroll Here
- Enrollment key: nC6sPu9Zxvs731
- Group name: Afternoon
- Group enrollment key: Secret456
where you give Secret123 to the Morning group users, and Secret456 to the afternoon users. (Obviously those are not the best of keys, so something a little harder to guess