Particle Publish Event

Please refer to Particle.io docs for full explanation of publishing events: https://docs.particle.io/reference/api/#publish-an-event

Inputs:

  • msg.payload - data used to send in the body
  • msg.accesstoken - accesstoken used in the header
  • msg.evtname - event name used in the post
  • msg.private - private flag, default is false
  • msg.ttl - time-to-live, default is 60 seconds

Outputs: HTTP response from the event post.

[{"id":"590b60c3.95c3c","type":"subflow","name":"Particle Publish Event","info":"Please refer to Particle.io docs for full explanation of publishing events:\nhttps://docs.particle.io/reference/api/#publish-an-event\n\nInputs:\n- msg.payload - data used to send in the body\n- msg.accesstoken - accesstoken used in the header\n- msg.evtname - event name used in the post\n- msg.private - private flag, default is false\n- msg.ttl - time-to-live, default is 60 seconds\n\nOutputs:\nHTTP response from the event post.\n\n","in":[{"x":127,"y":52,"wires":[{"id":"faaf06d5.132748"}]}],"out":[{"x":673,"y":128,"wires":[{"id":"98e375ae.435c38","port":0}]}]},{"id":"faaf06d5.132748","type":"function","z":"590b60c3.95c3c","name":"","func":"msg.headers = {\n    \"Authorization\": \"Bearer \" + msg.accesstoken\n};\nvar priv = msg.private === undefined ? false : msg.private;\nvar ttl = msg.ttl === undefined ? 60 : msg.ttl;\nmsg.payload = {\n    name: msg.evtname,\n    data: msg.payload,\n    private: priv,\n    ttl: ttl\n};\nreturn msg;","outputs":1,"noerr":0,"x":257,"y":101,"wires":[["98e375ae.435c38"]]},{"id":"98e375ae.435c38","type":"http request","z":"590b60c3.95c3c","name":"","method":"POST","ret":"txt","url":"https://api.particle.io/v1/devices/events","x":437,"y":159,"wires":[[]]},{"id":"959aca72.1af5c8","type":"subflow:590b60c3.95c3c","z":"fe896116.0176a","name":"","x":441,"y":835,"wires":[["99e13a96.067cf8"]]}]
ozzieg

Flow Info

created 1 year, 10 months ago

Node Types

Core
  • function (x1)
  • http request (x1)
Other
  • subflow (x1)
  • subflow:590b60c3.95c3c (x1)

Tags

  • particle
  • particle.io
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option