automatic plant watering system with sms alert using gsm sim900

good day!
can someone check my code whether it would send sms alert to the user when water pump is on. the water pump turns on and off but I cant receive a message with my previous codes.
thanks in advance!

#include <SoftwareSerial.h>
SoftwareSerial SIM900(1,2); // RX, TX
#include <DHT.h>;
char incoming_char=0;
#define WATERPIN 12
#define SENSOR A0
  

// higher number is more dry
#define MAXDRYNESS 500
#define WATERDELAY 5000
#define WATERPOSTDELAY 5000
#define DHTPIN 7     // what pin we're connected to
#define DHTTYPE DHT22   // DHT 22  (AM2302)
DHT dht(DHTPIN, DHTTYPE); //// Initialize DHT sensor for normal 16mhz Arduino
int maxHum =60;
int maxTemp =40;
int chk;
float hum;  //Stores humidity value
float temp; //Stores temperature value
   
void setup() {
 
  digitalWrite(WATERPIN, LOW);
  pinMode(WATERPIN, OUTPUT);
  Serial.begin(9600); // set the baud rate
  dht.begin();
  SIM900.begin(9600); // for GSM shield
  delay(20000);  // give time to log on to network.
  Serial.println("setup Section");
  SIM900.print("AT+CMGF=1\r");  // set SMS mode to text
  delay(100);
  SIM900.println("AT+CNMI=2,2,0,0,0\r"); 
  delay(100); 
}

void loop() {
 Soil_Moisture();
 dhtPrint();
}

 void Soil_Moisture()
  {
    int SensorValue = analogRead(SENSOR); //take a sample
    Serial.print("SoilMoisture=");
    Serial.print(SensorValue); 
     
  if(SensorValue >= MAXDRYNESS)
  {
     // if the soil is too dry start watering for 3/4 a second then
     // wait for 5 seconds before monitoring again
     Serial.println("Soil dry, start watering");
     digitalWrite(WATERPIN, HIGH);
     sendSMS1();
     delay(WATERDELAY);
     sendSMS2();
  }
   else if(SensorValue < MAXDRYNESS)
   {
     Serial.println("Soil is good");
     digitalWrite(WATERPIN, LOW);
     sendSMS2();
     delay(WATERPOSTDELAY);
   }
     
    
    delay(20000);
  }
  
  void dhtPrint()
{
    delay(2000);
    //Read data and store it to variables hum and temp
    hum = dht.readHumidity();
    temp= dht.readTemperature();
     if (hum>maxHum || temp>maxTemp)
    {
      digitalWrite(WATERPIN, HIGH);
    }
    else{
      digitalWrite(WATERPIN, LOW);
    }
    //Print temp and humidity values to serial monitor
    Serial.print("Humidity: ");
    Serial.print(hum);
    Serial.print(" %, Temp: ");
    Serial.print(temp);
    Serial.println(" Celsius");
    delay(10000); //Delay 2 sec.
}
 void sendSMS1()
 {
  SIM900.print("AT+CMGF=1\r"); // AT command to set SIM900 to SMS mode 
  delay(100);
  SIM900.println("AT + CMGS = \"+639387624644\"");// change to your sim900's your phone number 
  delay(100);
  SIM900.println(" WATER PUMP: ON");// Send the SMS 
  delay(100);
  SIM900.println((char)26);// End AT command with a ^Z, ASCII code 26 
  delay(100);
  SIM900.println();  // Give module time to send SMS
  delay(5000);  
}

 void sendSMS2()
 {
  SIM900.print("AT+CMGF=1\r"); // AT command to set SIM900 to SMS mode 
  delay(100);
  SIM900.println("AT + CMGS = \"+639387624644\"");// change to your sim900's your phone number 
  delay(100);
  SIM900.println("Soil is good");// Send the SMS 
  delay(100);
  SIM900.println((char)26);// End AT command with a ^Z, ASCII code 26 
  delay(100);
  SIM900.println();  // Give module time to send SMS
  delay(5000);  
}

I would start by looking at a tutorial such as this one;

Check that the everything is setup correctly.
In particular look a the status LED and the LED that shows if you have a network connection.

It turns out that the code I posted works fine unlike the previous codes I wrote. Still, Thanks for the link! It'll help me in improving the features of the system.

What I'd like to figure out is the delay in which the pump turns on and off. My code switches the pump with irregularity. Maybe it's because of the logic with the value of moisture sensor and dht22 sensor? Im a beginner at using condition statements.

Hysteresis indeed.

For your soil part, you switch on/off at 500. Make that when it goes over 500, and off when it goes under say 400 (use something sensible). Whenever the reading is in between nothing changes. that's important when you just reach the 500, as readings tend to not be perfectly stable, so you will be getting multiple readings on both sides of that threshold.

Also keep system reaction times in mind. You can start watering, but it may take say ten minutes for the water to reach your sensor, by when you have totally over watered the bed. So don't start watering until your reading is too low for a period of time, then water for a short time (so timing based rather than waiting for your sensor to react), wait, and water again if needed.