ESP8266 Digital Read failed

Hi, I am trying to build a project with my ESP8266, the idea is that after a receiving a sensor is triggered, the ESP8266 send a text via and APK.

so the WiFi part is working, Im able to connect to the network and send the text, but it keeps in a loop, I need to make sure that only when the sensor send the signal ONE text is send....

Please let me know what I'm doing wrong.

thank you in advance!

Here is my code

 #include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>


const char* ssid = "Uno";
const char* password = "12345678";

const char* host = "hooks.zapier.com";
const int httpsPort = 443;
const int API_TIMEOUT = 10000;
                

int val;

                
void setup()
{
  pinMode(10, INPUT);     
}

void loop() {

  val = digitalRead(10);   
 
  while (val == HIGH) {
    wifi1();
  }
}


void wifi1(){
           
   Serial.begin(115200);
  Serial.println();
  Serial.print("connecting to ");
  Serial.println(ssid);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("WiFi connected");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());

  WiFiClientSecure client;
  client.setInsecure();
  client.setTimeout(API_TIMEOUT);
  Serial.print("connecting to ");
  Serial.println(host);
  if (!client.connect(host, httpsPort)) {
    Serial.println("connection failed");
    return;
  
  }    
  
   String url = "https://hooks.zapier.com/hooks/catch/xxxxx0/o202tia/";
  Serial.print("requesting URL: ");
  Serial.println(url);

  client.print(String("GET ") + url + " HTTP/1.1\r\n" +
               "Host: " + host + "\r\n" +
               "User-Agent: BuildFailureDetectorESP8266\r\n" +
               "Connection: close\r\n\r\n");

  Serial.println("request sent");
  while (client.connected()) {
    String line = client.readStringUntil('\n');
    if (line == "\r") {
      Serial.println("headers received");
      break;
    }
  }
  String line = client.readStringUntil('\n');

  Serial.println("reply was:");
  Serial.println("==========");
  Serial.println(line);
  Serial.println("==========");
  Serial.println("closing connection");
}

You're calling your texting function when your input IS high, but you want to do it only when in BECOMES high. Look at the state change example in the IDE.