If you followed the tutorial I presented a couple of years ago about integrating Particle.io with InfluxDB and were unhappy, or simply couldn’t get it working, have I got a treat for you! Integrating Particle.io with InfluxDB Cloud is very straightforward and requires no outside services or customizations outside of what Particle Cloud already offers. Here are the steps to get it all working:
- Go to your Particle.io Console and click on the Integrations tab.
- Click on New Integration, and choose Webhook.
- Fill out the form! You need to know your event name, and it needs to be spelled exactly the same as it is in your on-device code!
- You’ll then enter the URL of your InfluxDB Cloud instance. It might be different depending on the region you signed up for, which can be found on Load Data > Client Libraries Page:
https://<your region>.<aws or gcp>.cloud2.influxdata.com/api/v2/write?org=YOUR_ORG&bucket=YOUR_BUCKET&precision=s
You will need to know the name of your Organization and Bucket as well, which you can grab from the InfluxDB Cloud management interface.
Next you’ll want to choose ‘Custom Body’ as your request format, and then expand the ‘Advanced’ setting as well. In there, you will insert the following:
You can set whatever tags, if any, that you’d like, and then use the ‘mustache’ notation to reference the Event Name and the Event Value, which will be used as the value name and value in InfluxDB.
Finally, you will need to add the Authorization Header exactly as below. The Authorization Header should have the value ‘Token long-token-string-from-InfluxDBCloud’ in it. This is the exact same header needed when accessing any of the InfluxDB Cloud APIs. You can then save your integration, and you’re all set.
Once you save your integration, you will see a page that tells you all the details of it:
And below that, it even gives you some sample on-device code that will trigger the integration:
And that’s it! So simple! Try it out and let us know what you think in our Community Slack.