beingfluid
Kilo Sage
Kilo Sage

Hi Developers,

This is the second article in the series for integrating ServiceNow with Google Calendar to schedule a meeting.

You need to follow the steps mentioned in the first article to continue with this post.

Step 1) Navigate to System Web Services > Outbound > REST Message and click 'New'

find_real_file.png

Step 2) Give it a unique name

find_real_file.png

Step 3) Copy and paste the below URL in the filed 'Endpoint'

https://www.googleapis.com/calendar/v3

find_real_file.png

This information is available on Google Calendar API reference

find_real_file.png

Step 4)  Select the Authentication Type as 'OAuth 2.0'

find_real_file.png

Step 5) Select the '

find_real_file.png

When a new OAuth provider is created, the system automatically generates a default profile for it without any scopefind_real_file.png

Step 6) Make sure the Accessible from value is selceted as 'All application ccopes' and click 'Submit'

find_real_file.png

Step 7) Open the record again and from the 'HTTP Methods' related list open 'Default GET'

find_real_file.png

Step 😎 Fill the form with the information provided below :

Name : Create an Event

HTTP Method : POST

Endpoint : https://www.googleapis.com/calendar/v3/calendars/${calendarId}/events

find_real_file.png

Authentication type : OAuth 2.0

find_real_file.png
Content-Type : application/json
find_real_file.png
Put the below script in the 'Content' field' and click 'Update'
{
  'summary': 'Google I/O 2015',
  'location': 'Online on Meet',
  'description': 'Testing Google Calendar APIs.',
  'start': {
    'dateTime': '2020-07-21T09:00:00-07:00',
    'timeZone': 'America/Los_Angeles'
  },
  'end': {
    'dateTime': '2020-07-21T17:00:00-07:00',
    'timeZone': 'America/Los_Angeles'
  },
  'recurrence': [
    'RRULE:FREQ=DAILY;COUNT=2'
  ],
  'attendees': [
    {'email': 'howtoreadthedocs@gmail.com'},
    {'email': 'ewbsri9@gmail.com'}
  ],
  'reminders': {
    'useDefault': false,
    'overrides': [
      {'method': 'email', 'minutes': 1440},
      {'method': 'popup', 'minutes': 10}
    ]
  }
}
find_real_file.png
find_real_file.png
Step 9) Click on the related link 'Auto-generate variables'
find_real_file.png
Step 10) In the related list 'Variable Substitutions' update the record 'calendarId' by setting the value to 'primary'find_real_file.png
Step 11) Click 'Get OAuth Token'
find_real_file.png
Step 12) Select your gmail account
find_real_file.png
Step 13 ) Click 'Advanced'
find_real_file.png
Step 14) Click 'Go to service-now.com (unsafe)
find_real_file.png
Step 15) Click 'Allow' at each of the below steps to grant permissions
find_real_file.png
find_real_file.png
find_real_file.png
 
Congratulations, So far we have built a rest message to schedule a meeting. 
Thank you,
 
Vishal Ingle
ServiceNow Certified System Administrator
DxSherpa Technologies Pvt. Ltd.
Maharashtra, IN.
 
Version history
Last update:
‎07-22-2020 02:06 PM
Updated by: