Google calendar v3 Push notification expiry

前端 未结 3 2018
轮回少年
轮回少年 2021-01-03 14:41

I am using Google Calendar Push Notifications. All is working well and I register my channel with no issue. Changes to the calendar result in a notification as expected.

3条回答
  •  既然无缘
    2021-01-03 15:10

    by default google keeps channel expiry time for one week, How ever you can set the channel expiry time upto one month by using ttl variable

      EX: body = {
              "id": uuid,
              "type": "web_hook" ,
              "token": "something_unique",
              "address": "web hook url",
              "params": {
                         "ttl" : 864000
                         }
              }
            calendar_service = get_calendar_service(user_email)
            resource = calendar_service.events().watch(calendarId='primary', body=body).execute()
    

    here ttl is in seconds ,and it keeps channel expiry time for 10 days

提交回复
热议问题