Transferring data using webhooks and thingspeak

I am new to particle. I have connected soil moisture sensor to a particle relay board. I flashed the following code to the photon.

// Pin definitions
int moistureRead = A2;
int moisturePower = D2;
int led = D7;  // The on-board LED

void setup() {
  pinMode(led, OUTPUT);
  pinMode(moisturePower, OUTPUT);
  pinMode(moistureRead, INPUT);
}

void loop() {
  digitalWrite(led, HIGH);   // Turn ON the LED
  digitalWrite(moisturePower, HIGH);   // Turn ON power to moisture sensor
  delay(2000);               //Wait for 2 seconds
  
  String sensor1 = String(analogRead(moistureRead));
  Particle.publish("sensor1", sensor1, PRIVATE);
  delay(5000);               // Wait for 5 seconds

  digitalWrite(led, LOW);    // Turn OFF the LED
  digitalWrite(moisturePower, LOW);    // Turn OFF the moisturesensor
  delay(15000);               // Wait for 10 seconds
}

The program runs and in the particle events it reports the following

Event
The source event that triggered the webhook

{
  "name": "sensor1",
  "data": "3259",
  "ttl": 60,
  "published_at": "2020-02-02T10:55:51.753Z",
  "coreid": "27004214234120b47353735"
}

This keeps updating. When I go to thingspeak I can see the connection but the data from the sensor is not coming through.

When I output the data to CSV I get the following.

|created_at|entry_id|field1|
|---|---|---|
|2020-02-02 10:37:31 UTC|850|sensor1|
|2020-02-02 10:37:53 UTC|851|sensor1|
|2020-02-02 10:38:15 UTC|852|sensor1|
|2020-02-02 10:38:37 UTC|853|sensor1|
|2020-02-02 10:38:59 UTC|854|sensor1|
|2020-02-02 10:39:21 UTC|855|sensor1|
|2020-02-02 10:39:43 UTC|856|sensor1|
|2020-02-02 10:40:05 UTC|857|sensor1|
|2020-02-02 10:40:27 UTC|858|sensor1|

Instead of outputting the data for sensor1 is simply reports the name sensor1.

Appreciate any insights to what I am doing wrong.

Thanks

John

How have you defined your webhook?

I used the webhook builder in particle.

The following images capture how I filled in the fields.

Thanks for helping

John

You actually told the webhook to use sensor1 as the value to use.
Instead use {{PARTICLE_EVENT_VALUE}}.

as shown here
https://docs.particle.io/tutorials/device-cloud/webhooks/#create-the-webhook

Thank you for your help

John

You were correct, it is working for me now. Initially I cut and paste {{PARTICLE_EVENT_DATA}} into the webhooks setup. That did not work. When I went back to the tutorial as you suggested. I realized that it says {{PARTICLE_EVENT_VALUE}}, when I changed data to value it worked. Not trying to be smart here, rather I have found looking at discussions online to be useful for problem solving so I thought I would follow up.

Thank you again for your help

John