I need to use ESP-01 8266 for sending HTTP signal to my server, when relay is ON

Hello,

I recently purchased Arduino UNO and ESP 01 8266.

I created simple program which is loaded on ESP01-8266 and sending HTTP request on every 5 seconds.

Now I want to do the following:
When I turn on the switch/ when I get ON Signal from a Relay, I need to send HTTP request with 1 to server.
When I turn off the switch/ when I get OFFSignal from a Relay, I need to send HTTP request with 0 to server.

I think this could be done using only ESP01 8266 with GP01,GP02. But I am not able understand properly.

Please help.