Problem with my coding

can someone help me for my code ?
i try to combine these two coding but always got error

the code that i want to combie this two code

BTW , i has try this two code and it work but when i combie it, it say error, this is my code after i combine it

//include libraty citybot
#include <CTBot.h>

String ph1="xxxxxx"; //Enter your phone number to call #01
String ph2="xxxxx8";   //Enter your phone number to call #02


#define pinreed 5 //pin D1 ReedSwitch -GPIO5
#define pinled 4 //D2 Led -GPIO4
#define pinbuzzer 14 // Buzzer -GPIO14
#define vibrationPin 16
bool flag=false;

//nama CTBot
CTBot myBot ;

//Wifi
String ssid = "xxxxxx"; //Enter your WIFI SSID
String pass = "xxxxxx"; //Enter your WIFI Password

//Telegram
String token = "xxxxx";
const int id = xxxxxxx;

//sensor aktik dan tidak aktif
int aktif = 1; //nilai awal ( 1 = aktif / 0 = tidak aktif )



void setup() {
  Serial.begin(9600);
  Serial.print("AT+CMGF=1\r\n"); //Text SMS mode in GSM
  pinMode (pinreed, OUTPUT);
  pinMode (pinled, OUTPUT);
  pinMode (pinbuzzer, OUTPUT);

              pinMode(vibrationPin,INPUT);
            digitalWrite(vibrationPin,LOW);
            //System Calibration
            for(int i=0;i<10;i++)
            {
              delay(200);
            }

//nodeMCU ke Wifi
myBot.wifiConnect (ssid, pass);
myBot.setTelegramToken(token);

//ujikaji sambungan
if (myBot.testConnection())
{
  digitalWrite(pinled, HIGH); //Lampu menyala
}
else
{
  digitalWrite(pinled, LOW); //Lampu tidak menyala
}
}

void loop() {

  int a=vibration();
                    if(a>15000){
                      flag=true;
                    }   
  

  //baca nilai sensor reedswitch
  int reed = digitalRead(pinreed);
  Serial.println(reed);

                  
//baca pesan sensor telegram on/off
TBMessage msg ;

//uji pesan baru masuk esp8266
if (myBot.getNewMessage(msg))
{
//baca pesan masuk
String pesan = msg.text;

//uji on/off
if (pesan == "ON")
{
  aktif = 1;
  myBot.sendMessage(msg.sender.id, "Sensor On");
  
}

else if (pesan == "OFF")
{
  aktif = 0;
  myBot.sendMessage(msg.sender.id, "Sensor Off");
  
}
}

//ujia jika sensor aktif
if (aktif == 1 && flag )
{
      //uji nilai buzzer
      if (reed == 0 ) //magnet jauh
      {
        //buzzer aktif
        digitalWrite (pinbuzzer, HIGH);

        message1();    //Generate the Alert Message First Mobile
  delay(1000);
  message2();   //Generate the Alert Message Second Mobile
  delay(1000); //1 minute delay
  call1();      //Call to First mobile
  delay(1000);
  call2();    
      delay(1000);    //call to Second mobile
    
        //notifikasi telegram
        myBot.sendMessage(id, "ALERT DOOR WAS OPEN");
      }
      else //nilai 1
      {
        //buzzer tidak aktif
        digitalWrite (pinbuzzer, LOW);
      }
      flag=false;
}
void message1()  //Method to send message #01
{
    Serial.print("AT+CMGS=\"");
    Serial.print(ph1);
    Serial.print("\"\r\n");
    delay(2000);
    Serial.print("---ALERT---\n Call Police , Any try to Unlock Door");
    Serial.write(0x1A);
}
void message2()   //Method to send message #02
{
    Serial.print("AT+CMGS=\"");
    Serial.print(ph2);
    Serial.print("\"\r\n");
    delay(2000);
    Serial.print("---ALERT---\n Call Police , Any One Try to Unlock Door ");
    Serial.write(0x1A);
}
void call1()   //Method to get call #01

{
  Serial.print("ATD");
  Serial.print(ph1);
  Serial.print(";\r\n");
  delay(10000);
  Serial.println("ATH");
}
void call2()   //Method to get call #02
{
  Serial.print("ATD");
  Serial.print(ph2);
  Serial.print(";\r\n");
  delay (10000);
  Serial.println("ATH");
}
int vibration(){
  delay(10);
  int vibrationDetection=pulseIn(vibrationPin,HIGH);  //wait for the pin to get HIGH and returns measurement
  return vibrationDetection;
  
}
  delay (500);
 

} 

the error say
'vibration' was not declared in this scope; did you mean 'vibrationPin'?
but when i change it, the error say this expression cannot be used as a function, hope anyone can help me find the solution for my problem

Your post was MOVED to its current location as it is more suitable.

The closing } of the loop() function is in the wrong place

If you Auto Format the code in the IDE you will see that the message1() function does not start on the left margin. The loop() function should end before the message1() function starts

Fix that and you will still have errors because the sketch ends in a very odd way

int vibration()
{
  delay(10);
  int vibrationDetection = pulseIn(vibrationPin, HIGH); //wait for the pin to get HIGH and returns measurement
  return vibrationDetection;
}
delay (500);
}

Should the last 2 lines be there ?