Getting information from photon onto thingspeak

So im part of a school project trying to monitor an aquaponics system and for now we are trying to make a webhook to that thingspeak takes the information from the photon and puts it inot an app. we are testing things around with thingspeak but this hook-error keeps popping up. i followed the tutorial for making a webhook but made my own program to get the potentiometer readings from the photon to go to the thingspeak. this is my program:

 #include <string.h>


int potPin = A0;

void setup(){


}

void loop() {

  // Use analogRead to read the potentiometer reading
  // This gives us a value from 0 to 4095
  String pot = String(analogRead(potPin));
  
  //Sends the information from pot onto the webhook into ThingSpeak
  Particle.publish("pot", pot, PRIVATE);


 
  delay(10000);
}

please help if possible thank you

Based on a working webhook I have you need something like this:

{
    "event": "pot",
    "url": "https://api.thingspeak.com/update",
    "requestType": "POST",
    "query": {
        "key": "<thing-api-key>",
        "field1": "{{PARTICLE_EVENT_VALUE}}"
    },
    "noDefaults": true,
    "mydevices": true,
    "deviceid": "<particle-device-id>"
}

If the above is in a file called webhook.json, then use the particle cli to create the webhook:

particle webhook create webhook.json

Alternative you can directly call Thingspeak from firmware:

https://community.particle.io/t/thingspeak-communication-library-written-by-the-thingspeak-development-team/15415

Really useful guide to webhook configuration and testing: Particle Webhooks Intermediate Tutorial

1 Like

Where Ina the program do these parameters go under?

Your program is good, you just need to install the particle cli on your computer, then create a file ‘webhook.json’ and then at the command line execute:

particle webhook create webhook.json

Oh, I see, thank you.

Or use https://console.particle.io/integrations to setup your webhook accordingly.

@Shane_Mats were you able to get your webhook to work?

No not yet but I’m still working on it. Thanks for the help.