Fedora Magazine fedocal calendar reminders

I don’t know if you’ve started on this part of the restructuring yet. But would it be possible to have the meeting reminders from Fedocal be posted to this site on behalf of the zinebot user?

My thought here is that I (or another Fedora Magazine editor) could then log onto this site as the zinebot user to edit or delete a post when necessary (e.g. to cancel a weekly meeting).

Okay, so, here’s my thoughts. :slight_smile:

  1. Turn off the email reminders from fedocal
  2. Have your bot use the Fedocal API and run weekly to find meetings in a future week (say, 2 weeks from now). Code below.
  3. Instead of printing, use that plus the Discourse API to post msg to the Magazine calendar topic. (I can help provide a code sample here if you need it.)
  4. Use the API to to set that post to be a wiki [1] so that anyone can update it to remove the date and instead put in a note that the meeting is canceled.

This is sample code to get meeting information for all upcoming meetings on a given calendar, in this case, marketing. It could be refined with a regex to filter on meeting_name if you want to make sure it’s just Magazine meetings.

#!/usr/bin/python

import requests
from datetime import datetime,timedelta

start=datetime.utcnow() + timedelta(weeks=2)
end=start+timedelta(weeks=1)
endpoint="https://calendar.fedoraproject.org/api/meetings/"
calendar='marketing'

r=requests.get(f"{endpoint}?calendar={calendar}"
               f"&start={start.strftime('%Y-%m-%d')}"
               f"&end={end.strftime('%Y-%m-%d')}")
if r.status_code != 200:
    r.raise_for_status()

for meeting in r.json()['meetings']:
    msg = (f"{meeting['meeting_name']}\n"
           f"[date={meeting['meeting_date']}"
           f" time={meeting['meeting_time_start']}"
           f" timezone=\"{meeting['meeting_timezone']}\"]"
           f" → "
           f"[date={meeting['meeting_date_end']}"
           f" time={meeting['meeting_time_stop']}"
           f" timezone=\"{meeting['meeting_timezone']}\"]"
           f"\n\n"
           f"{meeting['meeting_information']}"
           )

print(msg)

  1. I think this is PUT data wiki=true to /posts/{post_id}/wiki but I haven’t tested that ↩︎

1 Like

OK. I think I’ve turned off the emails from Fedocal. Updating Zinebot to generate the future meeting reminders shouldn’t be a problem.

Thanks for your help. :slightly_smiling_face:

P.S. I’d like to delete all the old meeting reminders just to clear out some clutter, but I don’t think I have that ability.

I was thinking the same for council ones — delete the ones with no replies, consolidate the ones that have some meaningful discussion.

Also, @bcotton I think we should do the same thing for Council reminders. @glb maybe we should generalize from “zinebot” to 'fedocalbot"?

I’m not sure what you are asking. I’m fine with having some other bot manage the posting of the meeting reminders to Discourse if that is what you are asking.

FWIW, I wouldn’t bother with trying to preserve posts that were made to old Fedora Magazine meeting reminders. I really don’t think there is anything important or worth preserving there.

Yeah, I mean making a bot specifically for calendar reminders.

1 Like

TBH I have it half-written with the above. Give me a little bit and I’ll polish it up. :slight_smile:

I’ve deleted most of them – kept a few which had some discussion. Maybe not super consequential, but it’s there if anyone wants it.

Happy New Year! I made:

https://pagure.io/fedocal2discourse

… which basically does what I said.

I made it so it uses an API key with permission to post as anyone (but it’s limited to just posting, so it could be annoying but not devastating if the key were compromised). Then, it’s a matter configuring

  • calendar
  • meeting name
  • who to post as
  • topic to post to

for each meeting we want bridged.

Also, right now, it doesn’t retry on failure or anything, and it probably should so meetings aren’t missed. (It should at least handle http 429 responses — too many API requests per minute.) There are number of more sophisticated things we could add, but I think with that it’s probably enough to get going.

Sample output:

1 Like

This is now in place and set to run every Monday morning to refresh upcoming meetings three weeks ahead.

This is far from perfect, as it doesn’t work very well as a reminder of, say, “tomorrow’s meeting”. It would be better for it to trigger on fedocal.calendar.update from the message bus and rewrite either any of its messages that have changed (somewhat tricky) or just delete all entries and recreate. There is also a fedocal.meeting.reminder, which is described as “These messages are published by a cronjob when time gets close to certain meetings scheduled in the fedocal calendaring system.” — I’m unclear on exactly what “certain meetings” means — maybe it’s at the same time an email reminder goes out, or maybe it’s something different.

@bcotton, I’m sure you have opinions :classic_smiley:

1 Like

Current configuration is https://pagure.io/fedocal2discourse/blob/main/f/fedocal2discourse.toml, by the way.

Maybe fedocal2discourse could schedule an email message with something like:

echo 'echo meeting tomorrow | mail -s "reminder" fas-email@example.com'  | at 08:00AM 2022-01-01

I’m definitely not getting in the business of generating mass emails. :slight_smile:

Of course, fedocal itself can still generate the reminders. The question is — where to send them to?

We guess I could have a second script run every day to add a “meeting tomorrow!” note to the calendar post.

Actually, I feel like there’s a “conflict of notification interest” here (caused by Discourse calendar using replies as the source of calendar event data). As a user, I don’t really want to be notified when new events are added to the calendar. I do want to be notified when that event is upcoming.

It might really be better to discard the calendar plugin and make something of our own which reads from Fedocal and updates the first post directly. It’s not like the calendar plug in is perfect. :slight_smile: We could probably create a theme component to make a calendar-style display — or just stick to list view. (Or, um, make markdown table calendars.)

It all sound good to me. :slightly_smiling_face: I would like to be able to have the meetings on the same calendar as the publications.

Ah, yeah — the current thing should work well for that … just add the publication dates as replies and there you go. That’d be harder to make work with a bridge bot unless you put each article date into Fedocal, which is a little heavyweight.