Users, Groups and On-Call Schedules with the AlertOps SDKs
Create users, organize them into groups and build fixed or rotating on-call shifts from code with the AlertOps SDKs, so the right person is always paged.
Overview
Relevant for Teams automating who is on call
On-call starts with people. With the AlertOps SDKs you can create users with their contact methods, organize them into groups and give each group a shift that decides who is on call, and in which role, at any moment. Automating this keeps AlertOps in step with your HR system, identity provider or team roster.
Key benefits:
- Repeatable setup — find-or-create helpers such as groups.ensure make scripts safe to run again and again.
- Shifts that follow best practice — the shift helper fills in names, time zones and dates for you, so every rotation starts with a Primary on call and leaves no gaps.
- One model in every language — the same calls work in Python, TypeScript, Go, Java and .NET.
Users
Relevant for Admins onboarding people
Create a user together with their contact methods in one call. users.create_with_email is a shortcut that creates a user with an official email address that is active around the clock.
| Task | Operation |
| Create a user with contact methods | users.create |
| Create a user with one email address | users.create_with_email |
| Look up a user by user name | users.find_by_username |
| List and search users | users.list |
| See a user's groups | users.groups |
You can also manage roles, out-of-office periods, user attributes and notification times from the same users resource.
Groups
Relevant for Admins building on-call teams
A group holds the people who respond together, such as a NOC or a database team. groups.ensure(name) finds the group by name or creates it, and tells you which it did. Add people with groups.members.add_users(group_id, user_ids); each new member joins as Primary unless you choose another role. Nest a whole team with groups.members.add_group.
| Task | Operation |
| Find or create a group | groups.ensure |
| Find a group by name | groups.find |
| Add users | groups.members.add_users |
| Add a nested group | groups.members.add_group |
| See where a group is used | groups.governance |
On-call schedules
Relevant for On-call managers creating shifts and rotations
A shift belongs to a group and decides who is on call. Two choices shape it:
| Choice | Options |
| Who is on call | Fixed always pages the same people in the same roles. Rotating moves members through the roles on a cadence, weekly by default. |
| When it applies | Continuous is one span across days, such as 24x7 or Friday evening to Monday morning. Block is a daily window on each weekday, such as weekday after-hours 17:00 to 07:59. |
schedules.create_shift builds a shift from a short description. It fills in each member's name, converts an IANA time zone such as America/Chicago, and applies the AlertOps scheduling best practices: the first member is Primary, the shift ends on the minute before the next one begins, and coverage runs well into the future.
Create a weekly after-hours rotation
This rotation covers Monday to Friday, 17:00 to 07:59, and rotates the on-call role through three members each week.
Python
shift = ao.schedules.create_shift(group_id, "After hours", [alice_id, bob_id, carol_id],
time_zone="America/Chicago", schedule_type="Rotating",
start_weekday="Mon", end_weekday="Fri",
start_time="17:00", end_time="07:59", continuous=False)
TypeScript
const shift = await ao.schedules.createShift(groupId, "After hours", [aliceId, bobId, carolId], {
time_zone: "America/Chicago", schedule_type: "Rotating", start_weekday: "Mon", end_weekday: "Fri",
start_time: "17:00", end_time: "07:59", continuous: false,
});
Go
shift, err := ao.Schedules.CreateShift(ctx, groupID, "After hours", []any{aliceID, bobID, carolID}, alertops.M{
"time_zone": "America/Chicago", "schedule_type": "Rotating", "start_weekday": "Mon", "end_weekday": "Fri",
"start_time": "17:00", "end_time": "07:59", "continuous": false,
})
Java
JsonNode shift = ao.schedules().createShift(groupId, "After hours", List.of(aliceId, bobId, carolId), Map.of(
"time_zone", "America/Chicago", "schedule_type", "Rotating", "start_weekday", "Mon", "end_weekday", "Fri",
"start_time", "17:00", "end_time", "07:59", "continuous", false));
.NET
var shift = await ao.Schedules.CreateShiftAsync(groupId, "After hours", new object?[] { aliceId, bobId, carolId }, new Kwargs
{
["time_zone"] = "America/Chicago", ["schedule_type"] = "Rotating", ["start_weekday"] = "Mon", ["end_weekday"] = "Fri",
["start_time"] = "17:00", ["end_time"] = "07:59", ["continuous"] = false,
});
Alice is on call in week one, and each week the next member moves into the on-call slot.

Figure 1. A 24x7 rotation built through the SDK, in the group's calendar. Each day shows (P) Alice and (S) Bob, the Primary and Secondary for the week.
You can also review a shift before saving it, read the on-call timeline for any date range, and update, disable or clone existing shifts.
Best Practices
Relevant for Teams scripting their on-call setup
- Build in order — users first, then groups and members, then shifts, then escalation policies.
- Pass the time zone on every shift so coverage lines up with the team's working day.
- Plan the whole setup at once — for complete rotations with escalation, use the semantic layer, which plans the shift and the escalation ladder together.
Related Articles
- AlertOps SDKs for Python, TypeScript, Go, Java and .NET
- Escalation Policies and Response Plays with the AlertOps SDKs
- Planning On-Call Setups with the AlertOps Semantic Layer
Need help?
Email support@alertops.com or contact your AlertOps representative.