Right now we're using the icalendar gem to generate an ics file that we send via email.
While this does give the user a convenient "Add to my Calendar" button through email, it does not automatically add the event to the user's calendar too, making it so the user still has to do that manual step themselves.
Is there any way to make it so that the event is automatically added to the user's calendar? This has been hard to find a solution for.
def add_calendar_event
@cal = Icalendar::Calendar.new
@cal.event do |e|
e.dtstart = start_time
e.dtend = end_time
e.summary = 'Organized Appointment'
e.organizer = organizer_email
e.attendee = user_email
e.description = 'random string'
e.status = 'CONFIRMED'
end
@ics_var = { mime_type: 'text/calendar; charset=UTF-8; method=REQUEST', content: @cal.to_ical }
end
CodePudding user response:
This requires a bit more understanding of calendars.
They use .ics files as a format for events, but calendars require users to add those events to their calendars.
For pure automation you must ask the user to "Authenticate with {Google/Outlook/ETC}" and provide "authorize read/write access to app".
Then you would be able to automatically add events to calendar.
