Skip to content

Instantly share code, notes, and snippets.

@ozzieg

ozzieg/README.md Secret

Created April 3, 2016 18:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ozzieg/063b79a8b4916cb4059c2bf4c57d4850 to your computer and use it in GitHub Desktop.
Save ozzieg/063b79a8b4916cb4059c2bf4c57d4850 to your computer and use it in GitHub Desktop.
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"]]}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment