When attempting to subscribe to a Google Sheets webhook I am setting the expiration time but receiving the error:
pushInvalidTtl: Invalid ttl value for channel -1477712661
This is the call I am making:
Google::Apis::DriveV3::Channel.new(
id: self.id,
address: "https://#{ENV['DOMAIN']}/api/google/webhook",
type: "web_hook",
resource_id: resource_id,
expiration: (Time.current + 99.years).to_i
)
Google expects Unix timestamps to be in milliseconds, the above call works when the expiration is set like so:
Google::Apis::DriveV3::Channel.new(
id: self.id,
address: "https://#{ENV['DOMAIN']}/api/google/webhook",
type: "web_hook",
resource_id: resource_id,
expiration: (Time.current + 1.week).to_i * 1000
}
Also, Google doesn't allow you to subscribe to a webhook for longer than a week.