Push notification for google calendar not working
You must implement Watch
method. To set up a notification channel for messages about changes to a particular resource, send a POST
request to the watch
method for the resource.
Each notification channel is associated both with a particular user and a particular resource. A watch request will not be successful unless the current user owns or has permission to access this resource.
Request:
https://www.googleapis.com/apiName/apiVersion/resourcePath/watch
Start watching for changes to a collection of events on a given calendar:
POST https://www.googleapis.com/calendar/v3/calendars/example.com/events/watch
Authorization: Bearer auth_token_for_current_user
Content-Type: application/json
{
"id": "01234567-89ab-cdef-0123456789ab", // Your channel ID.
"type": "web_hook",
"address": "https://example.com/notifications", // Your receiving URL.
...
"token": "target=myApp-myCalendarChannelDest", // (Optional) Your channel token.
"expiration": 1426325213000 // (Optional) Your requested channel expiration time.
}
}
Response:
{
"kind": "api#channel",
"id": "01234567-89ab-cdef-0123456789ab"", // ID you specified for this channel.
"resourceId": "o3hgv1538sdjfh", // ID of the watched resource.
"resourceUri": "https://www.googleapis.com/calendar/v3/calendars/example.com/events", // Version-specific ID of the watched resource.
"token": "target=myApp-myCalendarChannelDest", // Present only if one was provided.
"expiration": 1426325213000, // Actual expiration time as Unix timestamp (in ms), if applicable.
}
After creating a new notification channel to watch a resource, the Google Calendar API sends a sync message to indicate that notifications are starting. The X-Goog-Resource-State
HTTP header value for these messages is sync. Because of network timing issues, it is possible to receive the sync message even before you receive the watch
method response.
iOS local notification and calendar event does not appear while app is not running
I would like to share with someone who's stuck this like me,
here's Apple's troubleshooting, and it's really helpful:
https://developer.apple.com/library/archive/technotes/tn2265/_index.html
my finally solution is the trigger time beyond 60s.
Issue with google calendar push notification
Google sends the response in the headers as an array.
Try this:
$response = apache_request_headers();
if($response) {
print_r($response);
}else {
echo 'The apache_request_headers() did not find any headers.'; //Or google is not sending any.
}
You may also try:
getallheaders()
if the apache_request_headers did not work.
Testing this can be difficult. You may want to set up a log that sends any data your page gets to a table on your database so that you can go back and inspect to see what type of progress you are making.
Related Topics
How to Batch Convert Mp4 Files to Ogg with Ffmpeg Using a Bash Command or Ruby
Rails Fastercsv "Unquoted Fields Do Not Allow \R or \N"
What Is the Standalone Splat Operator (*) Used for in Ruby
Rails Routes: Wrong Singular for Resources
Enable Dropping a File Onto a Ruby Script
Generate Nested Hashes from Strings and Deep Merging in Ruby
Error Using PHPstorm's SASS File Watcher
How to Convert Any Method to Infix Operator in Ruby
How to Make Id a Random 8 Digit Alphanumeric in Rails
Calendar Events Notification Not Received on Server
How to Rescue from a 'Require': No Such File to Load in Ruby
Is There a Difference Between :: and . When Calling Class Methods in Ruby
Bundler - Load Multiple Gemfiles