Welcome to Portal

?Unknown\pull-down

Welcome to Zoho Cares

Bienvenido a Soporte de Zoho

Search our knowledge base, ask the community or submit a request.

So I manage to cobble some code together, but how I sort out the API side things to get the app and zoho calendar to communicate with each other.

1 user has this question.
7 Replies
Reply

So do I do I need to the api token as a custom api  or this way Steps for generating OAuth Token | OAuth | Access | Zoho People

  • Zoho MVP
  • 18 days ago

You shouldn't need to generate anything, if you create a connection to Zoho Calendar it should generate everything for you and then you just use the connection link name in an invokeURL task, see: https://www.zoho.com/deluge/help/webhook/invokeurl-api-task.html

There's also a new task to create new events in Zoho Calendar, see: https://www.zoho.com/deluge/help/calendar-tasks.html

Hi
 ,

You can also try using Zoho flow. 


void calendar()
{
    // Define the parameters
    owner_name = "peter.fraser";
    app_link_name = "xxxxxxxxxx";
    report_link_name = "xxxxxxxx";
    criteria = "";
    from_index = 1;
    limit = 200;
    connection_link_name = "xxxxxxxxxxxx"; 

    // Fetch the list of events from the form or report
    events_list = zoho.creator.getRecords(owner_name, app_link_name, report_link_name, criteria, from_index, limit, connection_link_name);

    // Loop through each event
    for each event in events_list
    {
        event_name = event.get("PM_Due");
        event_date = event.get("Calibration_Due");
        event_time = event.get("Install_date");
        client_name = event.get("Client_Name");
        location = event.get("Location");

        // Log the event details
        info "Event Name: " + event_name.toString();
        info "Event Date: " + event_date.toString();
        info "Event Time: " + event_time.toString();
        info "Client Name: " + client_name.toString();
        info "Location: " + location.toString();

        // Ensure event details are not empty
        if(event_name != null && event_date != null && event_time != null && client_name != null)
        {
            // Format the start and end times
            start_time = event_date + "T" + event_time + ":00";
            end_time = event_date + "T" + (event_time.toLong() + 1).toString() + ":00"; // Adjust this as needed

            // Create the event in Zoho Calendar
            try
            {
                event_details = {
                    "summary": event_name + " - " + client_name,
                    "start": {"dateTime": start_time, "timeZone": "UTC"},
                    "end": {"dateTime": end_time, "timeZone": "UTC"}
                };

                // Add location if it's not empty
                if(location != null && location != "")
                {
                    event_details.put("location", location);
                }

                // Print the event details
                info "Creating event: " + event_details.toString();
                response = zoho.calendar.createEvent("primary", event_details);
            }
            catch (e)
            {
                // Handle any errors that occur during the API call
                info "Error creating event: " + e.toString();
            }
        }
        else
        {
            info "Event details are missing for one of the events.";
        }
    }
}


This is what I came up with thinking i needed to add the token.
 
 

  • Zoho MVP
  • 18 days ago

You don't need to use the integration task to fetch records if you are working within the same application, see: https://www.zoho.com/deluge/help/fetch-records.html

When you fetch the records directly you can add criteria to filter them so that you won't need to use null checks...

Yeah, added the null check to see if I was getting anything back at all. So I looked at flows again and its working, thanks again for your help guys.

Reply to peter.fraserA
/* */
  • 12
  • Insert
  • Plain text
Add Comment
(Up to 20 MB )