How to create an event in an agenda


I am looking for the possibility to create, move and delete an event in an agenda by the way of a simple mail, for example, or any other way

I have seen that it is possible to create a .ics file in wich it is possible to create an event.
This kind of file is recognized by gMail, or even windows... but it is necessary to open manually the mail, clic on the .ics attachment, and validate the insertion in the google agenda, for example.

What I need it to be able to send this event, and that this event is automatically inserted in an agenda.

For sure, the best way would be to use a simple mail with a specific syntax or an attached file. This syntax of file will have to be created by my PLC. It can run node-red.

  • so, has anybody any experience to do what I need?
  • can an event be automatically inserted in an agenda?
  • how would it be possible to handle a created event : for example, to move it, or delete it?

I have seen that node-red includes a library for google services, and an agenda node is available. But there is no example. It is not so clear.

so, if anybody has got an idea, and some example it would be great.

Most if not all email clients will not auto-process file attachments, even .ics files since the opportunity for abuse is very high.

Depending on the back-end mail system, it might have an API that would let you do this. You should be able to do it with Google Calendar for example though probably not via an ics file but rather by using the API directly. I think there is an existing node for that.


Thanks for your reply, but even if I
have seen the node for google, i have some problems to create the credentials,

I have not found an example in the node-red

but any help would be welcome

For example, i don't understand this
notice :

so, even if I have entered my clientID
and my Secret, i get a reply like this :


I suppose it it linked to the message
below :


But i don't undersstand it.

Can anybody help me?

I have tried to follow the quick start that is available here, but I get this result :slight_smile:

admin@axcf2152:~$ node .

ReferenceError: is is not defined
    at Object.<anonymous> (/opt/plcnext/index.js:8:1)
    at Module._compile (internal/modules/cjs/loader.js:701:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
    at Module.load (internal/modules/cjs/loader.js:600:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
    at Function.Module._load (internal/modules/cjs/loader.js:531:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

Has anybody an idea of what must be done?
I just want to be able to send events in the google calendar.
Why is this so complicated? (sorry, I'm a newbie)

Now it seems that I can register at the google API. The problem was coming from a bad syntax in the comments of the index.json file.

But now, i still have problems.
In the node Calendar,

When i clic on Authenticate with google, i get this reply in my browser :

**Error: redirect_uri_mismatch**

Request Details

* response_type=code
* state=2f6df1fb.726dee:S-ZlDJ5KEs_dxUczT1g35Xn4
* access_type=offline
* approval_prompt=force
* scope=profile
* redirect_uri=

<ins>That’s all we know.</ins>

I don't understand what must be done with the hosts file.
Do I just have to copy the shown url in this file? What is the correct syntax?
Can you help me?

The hosts file has 1 entry per line.

In your case, you need something like:

Once saved, in a browser try to navigate to

I want to add some details.
Node-red is installed on a PLC.
And I access to this PLC with a PC, of course (via putty)
The PLc is connected to the web, and my Pc also.
But they don't use the same way to access to internet.
Can this be a problem?
Nevertheless, I have modified the hosts file of my PLC including this line :slight_smile:

And, on my PC windows 10, I have inserted the following line in the hosts file :slight_smile:

( is the actual adress of my PLC running node-red)

When I try to ping from my PC, I get a correct reply :slight_smile:
PS C:\WINDOWS\system32> ping

Envoi d’une requête 'ping' sur [] avec 32 octets de données :
Réponse de : octets=32 temps=1 ms TTL=64
Réponse de : octets=32 temps=1 ms TTL=64
Réponse de : octets=32 temps=1 ms TTL=64
Réponse de : octets=32 temps=1 ms TTL=64

and in my browser, if I type, I can access to the Node-red programming interface.

But i still get the same error when I clic on authenticate with google.

**Error: redirect_uri_mismatch**

Request Details

* response_type=code
* state=24a2aa3a.febf06:hq4zClLMaVhsWanxqIhki7hX
* access_type=offline
* approval_prompt=force
* scope=profile
* redirect_uri=

<ins>That’s all we know.</ins>

(of course, i have anonymized the cliend ID in the previous lines)

Can you help me to find why I get this error? Is something missing?

For your information, if I type the complete adress : image chrome returns this :slight_smile:

And here is what node-red returns in the putty window :slight_smile:

Is this usefull for debug?

  • Missing google credentials
  • Split on undefined payload (probably caused by the missing credentials)

credentials.json downloaded from google is in my working directory.

When I type node . I get the content of my agendas in putty

So why the acces is allowed from putty, but impossible from node red google oAut?

Check permissions on the file.

I suppose you talk about the credentials.json owner and properties :slight_smile:

and I am logged as admin

So what does your flow look like, you are already processing the data while authentication fails ?

No, the identification fails when I clic
on the button 'Authenticate with Google'.

Here is the flow :

calendar out","z":"c5b7b4e8.8ed438","google":"","name":"hello","calendar":"Test","x":650,"y":380,"wires":},{"id":"b06392ed.5a3e2","type":"inject","z":"c5b7b4e8.8ed438","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":320,"y":380,"wires":[["af608273.20c19"]]},{"id":"af608273.20c19","type":"function","z":"c5b7b4e8.8ed438","name":"","func":"msg.payload
= {\n'colorId': 3,\n'summary': 'summary',\n'location': 'location',\n'description':
'description.',\n'start': {\n'dateTime': '2019-07-28T15:00:00',\n'timeZone':
'Europe/Zurich',\n},\n'end': {\n'dateTime': '2019-07-28T19:00:00',\n'timeZone':
'Europe/Zurich',\n},\n'event':{\n'colorId': 'purple',\n'foreground': 'purple',\n},\n};\nreturn

Hello everyone
Any suggestion?

Google oauth2 was I pain for me.
I did the following:

• Installed node-red in a online server;
• Created a app-key in google dashboard;
• Created a endpoint, using http node, where google would send me tokens;
• Created a flow that request a new token to be send regularly, since it its mandatory because tokens expire after sometime;
• Store token in flow context;
• Used tokens to make http calls to google calendar api;

I´m new to programing and to node red, so this whole process was really painful buts it's actually simple. Read the link below and pay attention because I don't think is aimed to noobs like me.

Google oauth

1 Like

Sounds like a steady solution to me. Periodically refreshing by calling new tokens is a nice one too. :+1:

1 Like

There is an oauth2 node for node-red available.

1 Like

I don't remember why, but with me it wasn't successful.

Hello paulohlp.
Can you give me more details about what must be modified/adapted in your example flow.
I have seen for example the adress I suppose i muts here change something and give the IP adress of my nodered server?
But my nodered server is not accessible from the web. Is this a problem?

And when you write username and password, do you mean the username and password of the google account? I must change it in the nodes?

In my case I hosted node-red on heroku. I did not try in a local machine, sorry. I have no clue how to start on local.
I think that google oauth2 documentation is a good place to start.