node-red-web-nodes icon indicating copy to clipboard operation
node-red-web-nodes copied to clipboard

Calendar events with links (Google Meet)

Open jorgebrunal opened this issue 2 years ago • 1 comments

Proposed changes

  • New feature (non-breaking change which adds functionality)
  • Add and validate the conferenceDataVersion field that allows the creation of events with link

modify the file calendar.js

Which node are you reporting an issue on?

Google Calendar out

What are the steps to reproduce?

allow the creation of events with link for Google Meet

What happens?

currently, when using an object representing the request body for an insert request does not allow to create events in Calendar with links

What do you expect to happen?

well... that when creating an event in Calendar it is allowed to create links :smile:

Please tell us about your environment:

  • [ ] Node-RED version: 2.2.2
  • [ ] node.js version: v14.18.2
  • [ ] npm version: 6.14.15
  • [ ] Platform/OS: Manjaro 21.2.4 Qonos
  • [ ] Browser: Opera 84.0.4316.14

Full example:

modify the file calendar.js, line 596

...

if (typeof msg.payload === 'object') {
    request.url = 'https://www.googleapis.com/calendar/v3/calendars/'+cal.id+'/events';

    // add the following lines
    // start
    if (msg.conferenceDataVersion){
        request.url += '?conferenceDataVersion='+msg.conferenceDataVersion;
    }
   // end

    request.body = msg.payload;
} else {
    request.url = 'https://www.googleapis.com/calendar/v3/calendars/'+cal.id+'/events/quickAdd';
    request.form = {
        text: RED.util.ensureString(msg.payload)
    };
}

...

msg.conferenceDataVersion

msg.conferenceDataVersion: 1

msg.payload

{
    "summary": "Google I/O 2015",
    "location": "800 Howard St., San Francisco, CA 94103",
    "description": "A chance to hear more about Google\"s developer products.",
    "start": {
        "dateTime": "2022-04-22T09:00:00-07:00",
        "timeZone": "America/Los_Angeles"
    },
    "end": {
        "dateTime": "2022-04-22T17:00:00-07:00",
        "timeZone": "America/Los_Angeles"
    },

    // add the following object
    // start
    "conferenceData": {
        "createRequest": {
            "requestId": "example-id", // any text, it seems
            "conferenceSolutionKey": {
                "type": "hangoutsMeet" // required
            }
        }
    },
    // end

    "reminders": {
        "useDefault": false,
        "overrides": [
            {
                "method": "popup",
                "minutes": 10
            }
        ]
    },
    "guestsCanInviteOthers": true,
    "guestsCanModify": false,
    "guestsCanSeeOtherGuests": true
}

flow example

flow code

[{"id":"875e480c83ddb182","type":"tab","label":"crear evento","disabled":false,"info":"","env":[]},{"id":"f77cdc04894bbe11","type":"google calendar out","z":"875e480c83ddb182","google":"","name":"calendar_create","calendar":"","x":690,"y":220,"wires":[]},{"id":"1995faf00e16953f","type":"inject","z":"875e480c83ddb182","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":170,"y":220,"wires":[["083715e35c4a0da2"]]},{"id":"083715e35c4a0da2","type":"change","z":"875e480c83ddb182","name":"create_custom_event","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"summary\":\"Google I/O 2015\",\"location\":\"800 Howard St., San Francisco, CA 94103\",\"description\":\"A chance to hear more about Google\\\"s developer products.\",\"start\":{\"dateTime\":\"2022-04-22T09:00:00-07:00\",\"timeZone\":\"America/Los_Angeles\"},\"end\":{\"dateTime\":\"2022-04-22T17:00:00-07:00\",\"timeZone\":\"America/Los_Angeles\"},\"conferenceData\":{\"createRequest\":{\"requestId\":\"example-id\",\"conferenceSolutionKey\":{\"type\":\"hangoutsMeet\"}}},\"reminders\":{\"useDefault\":false,\"overrides\":[{\"method\":\"popup\",\"minutes\":10}]},\"guestsCanInviteOthers\":true,\"guestsCanModify\":false,\"guestsCanSeeOtherGuests\":true}","tot":"json"},{"t":"set","p":"conferenceDataVersion","pt":"msg","to":"1","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":240,"wires":[["f77cdc04894bbe11"]]}]

more info:

my apologies for the translation, I do not speak English.

thanks!

jorgebrunal avatar Apr 22 '22 01:04 jorgebrunal

looks good - would you like to create Pull Request for this, or wait for me to have time to cut/paste it ? Thanks

dceejay avatar Apr 22 '22 09:04 dceejay