Sign In Try it free

Create Event


Event model

See event model in the reference.

Simple Event

A simple event can be set up as follows:

NOTE:
By default, a calendar event is created in the default calendar fort he specified integration

Example

token = "<user's token>"
client = LivilApi::Service.new(token)

# using attribute writers 
event = LivilApi::Event.new
event.integration_id = 'def12gdebac28abgf2'
event.name = 'Test Meeting'
event.description = 'Meeting to discuss some important things'
event.location = 'Suite 200, Scranton Business Park, 1725 Slough Avenue, Scranton, PA'
event.start_date_time = '2020-02-01T13:45:00'
event.start_timezone = 'America/New_York'
event.end_date_time = '2020-02-01T14:45:00'
event.end_timezone = 'America/New_York'
event.all_day = false

# alternatively, using keyword args on initialization 
event = LivilApi::Event.new(
  integration_id: 'def12gdebac28abgf2',
  name: 'Test Meeting',
  description: 'Meeting to discuss some important things',
  location: 'Suite 200, Scranton Business Park, 1725 Slough Avenue, Scranton, PA',
  start_date_time: '2020-02-01T13:45:00',
  start_timezone: 'America/New_York',
  end_date_time: '2020-02-01T14:45:00',
  end_timezone: 'America/New_York',
  all_day: false
)

response = client.create_event(event: event)

response
# => LivilApi::Event(id: '...', name: 'Test Meeting', ...)

Creating in a specific calendar

To specify which calendar the event should belong to, simply include the WorkAPI ID for the calendar in the `calendar_id` field on the `Event` object.

Attendees

By adding attendees, the underlying provider will notify them of the event via their email addresses and allow them to RSVP.

Examples

token = "<user's token>"
client = LivilApi::Service.new(token)

# using attribute writers 
event = LivilApi::Event.new
event.integration_id = 'def12gdebac28abgf2'
event.name = 'Meet With Team'
event.start_date_time = '2020-02-01T13:45:00'
event.start_timezone = 'America/New_York'
event.end_date_time = '2020-02-01T14:45:00'
event.end_timezone = 'America/New_York'
event.attendees << LivilApi::EventAttendee.new(email_address: 'someone@domain.com', display_name: 'S. Omeone')

# alternatively, using keyword args on initialization 
event = LivilApi::Event.new(
  integration_id: 'def12gdebac28abgf2',
  name: 'Test Meeting',
  start_date_time: '2020-02-01T13:45:00',
  start_timezone: 'America/New_York',
  end_date_time: '2020-02-01T14:45:00',
  end_timezone: 'America/New_York',
  attendees: [{ email_address: 'someone@domain.com', display_name: 'S. Omeone' }]
)

response = client.create_event(event: event)

response
# => LivilApi::Event(id: '...', name: 'Test Meeting', attendees: [LivilApi::EventAttendee(email_address: 'someone@domain.com', ...)])

Recurrence

WorkAPI event objects use the iCal Recurrence Rule standard.

There are many libraries available that allow easy construction of these rules.

The recurrence rule may consist RRULE, RDATE, and EXDATE and should be separated by \n.

Example

# every third day, for ten occasions
recurrence_rules = 'RRULE:FREQ=DAILY;INTERVAL=3;COUNT=10\nRDATE;VALUE=DATE:20200420'

event = LivilApi::Event.new(
  integration_id: 'def12gdebac28abgf2',
  name: 'Test Meeting',
  start_date_time: '2020-02-01T13:45:00',
  start_timezone: 'America/New_York',
  end_date_time: '2020-02-01T14:45:00',
  end_timezone: 'America/New_York',
  recurrence: recurrence_rules 
)

response = client.create_event(event: event)

response
# => LivilApi::Event(id: '...', name: 'Test Meeting', recurrence: 'RDATE;VALUE=DATE:20200420\nRRULE:FREQ=DAILY;INTERVAL=3;COUNT=10')

MS 365 Calendar limitations

NOTE:
MS 365 Calendar doesn't currently support (as of April 2020) RDATE and EXDATE or an equivalent. In order to see which occurences are excluded or excluded from a set, retrieve the event instances using the [TBD] endpoint.

WARNING:
Attempts to set RDATE or EXDATE on a MS 365 event will return a 400 error.

First 50,000 requests are free every month