Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

549
Views
How do I know when a Google calendar event was added there or deleted from there?

I want to sync my own calendar (react-big-calendar) with a Google Calendar. I can retrieve Google calendar events from a primary calendar and display them in my own calendar built using react-big-calendar library. When I add a new event to a Google calendar, I want to see the event added to my own calendar as well without reloading the page. Because on every reload I call a function that fetches the events from a Google Calendar. But I need to do that once there is a change to a Google Calendar. How can I do that?

Backend: python, django

Frontend: react js

        # authorization
        def get_crendetials_google():
            flow = InstalledAppFlow.from_client_secrets_file(
                "credentials.json", SCOPES)
            creds = flow.run_local_server(port=8080)
            pickle.dump(creds, open("token.txt", "wb"))
            return creds

        
        @api_view(['GET'])
        def get_all_events(request):
            creds = None
            if path.exists("token.txt"):
                creds = pickle.load(open("token.txt", "rb"))
            if not creds or not creds.valid:
                if creds and creds.expired and creds.refresh_token:
                    creds.refresh(Request())
                else:
                    creds = get_crendetials_google()
            result = []

            # instantiating a calendar and retrieving google events
            try:
                service = build("calendar", "v3", credentials=creds)
                response = service.events().list(calendarId="primary").execute()
                for event in response["items"]:
                    title = event.get("summary")
                    obj = {}
                    if title:
                        obj["title"] = title
                        obj["start"] = event["start"]
                        obj["end"] = event["end"]
                        result.append(obj)
                result = reformat_events(request, result)
            except OSError as err:
                return Response({'error': "OS error: {0}".format(err)}, status=400)
            return Response(result, status=200)

  useEffect(() => {
      getEvents();
  }, []);

  const getEvents = async () => {
    let response = await fetch("http://localhost:8000/gcevents/", {
      method: "GET",
      headers: {
        "Content-Type": "application/json",
        Authorization: "Bearer " + String(authTokens.access),
      },
    });
    let data = await response.json();

    if (data) {
      props.sendEvents(data);
    }
  };

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!