Sending variables in AT commands with ESP32

Good morning, I need to send a variable via serial in AT command with ESP32. I am using a LoRaWAN module with UART interface, the AT sending command is AT + SEND = port: message. In the message I need to transmit a variable, the manufacturer’s sample documentation uses the Software Serial library, which is not compatible with ESP32. Below is the code.

#include <HardwareSerial.h>

void setup() {
  Serial2.begin(9600, SERIAL_8N1, 16, 17); //using RX2 and TX2 from ESP

void loop() {
  Serial.println("Teste de Envio");
  Serial2.write("AT+SEND=1:mensagem de envio\r"); //instead of a sending message, a variable must be sent
  while (Serial2.available()) {
    int g =;