Error in a code using telegram

Here is code. I’m getting some errors. Can anyone help me in debugging the errors.

here is the screen shot of error

Please check once whether the device is online and execute the code.

Please try to help me out friends

So in while loop, you already got the value in variable sensor_value using the line

sensor_value = get_sensor_value_from_pin("A0")
So you don’t need to use the line
sensor_value = int(data["value"])

Above line won’t work because ‘data’ is a json type variable declared in function get_sensor_value_from_pin() . you can use ‘data’ only inside that function.