Can't create events inviting many built-in groups

Seems the only option for invitees are: “Everyone” (Troop-nnnn), patrols (Patrol-nnnn), or users (User-nnnn).

This is quite limiting since a number of the built-in groups are not represented in this set, such as: PLC, leaders, or parents.

Nor are any of the customized groups that are available normally (eg. our troop has Scoutmaster, SPL, ASMs, Quartermaster, etc, etc…)

It would be great to have these additional groups available in the API so that we could fully automate our yearly calendar!!!

Thanks for the support!

-Eoin

Ah ha! I found that you CAN do built-in groups – by using MailingLists!

First enumerate the mailing lists from the API, then, when creating events, use ‘MailingLists-nnn’ using the mailing list ID.

Works like a charm! Sweeeet!

Eoin - I’m not able to even get the event creation to work. Do you have some code that you can share? I’m using Python right now, I’m doing something like this:

    postdata = {"event":{"title":"Troop Meeting"}}
    # Meeting event type
    postdata["event"]["event_type_id"] = "52183"
    postdata["event"]["location"] = "Church"
    postdata["event"]["start_at"] = str(startdate) + "T18:00-0600"
    postdata["event"]["end_at"] = str(startdate) + "T19:30-0600"
    postdata["event"]["description"] = "Test"
    postdata["event"]["inviteable_tokens"] = scList
    # ourtroop is just a placeholder for this example
    eventsURL = "https://ourtroop.trooptrack.com:443/api/v1/events"

    headers = {"Content-type" : "application/json",
               "X-Partner-Token" : XPartnerToken,
               "X-User-Token": XUserToken}

    response = requests.post(eventsURL, headers=headers, data=postdata)

I’ve tried removing the inviteable_tokens line completely as well as just setting it to an empty string and nothing works. Current, scList is an array of ‘User-’ values like it mentions in the spec. In all cases, I get Error 400 and I’m not sure what I’m doing incorrectly here.

Thanks!

Any ideas?

I’ve posted some code here:

Let me know if that doesn’t help!

Thanks Eoin!

The only change that was needed was to switch the output from a regular dictionary to a string via this one line

    postdata = json.dumps(postdata)

I had to wade through your code a bit, but once I saw that, I realized that was probably my issue. I didn’t have to do this when getting the tokens though. So, it’s weird that it’s needed for the events, but not the tokens. Or maybe it’s only needed when you have a dictionary of dictionaries. i.e. the token is just 3 entries in one dictionary. The event request is a dictionary with multiple entries inside the one entry (‘event’) dictionary.

It’s too bad we can’t disable RSVP from the API as well. After creating my events, I’ll have to go back and disable the RSVP by hand.

Thanks for the pointer!

1 Like

Update here: I just found out how to create an event without an RSVP:

    postdata["event"]["rsvp_required"] = 0

Just set that in your post data and the event no longer needs and RSVP. Hope it helps!

1 Like