Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

269
Visualizações
Send 2 slack messages with 1 Google Forms answer - 1 as new message and 1 as its reply

I have a Google Apps Script script from a spreadsheet to send an automatic message to slack (and an auto-reply email) when a Google Form answer is submitted. How do I send 2 slack messages in 1 script, one as a new message in a specific channel and another as a reply (thread) to the message I just sent? The current script runs as a single slack message like below and I want to split it into 2; sending the --REQUEST CONTENT-- part as a thread.

function autoReply(e) {
  var values = e.values;

  var name    = values[1];
  var email   = values[2];
  var phone   = values[3];
  var office  = values[4];
  var comment = values[5];
  
  var title = "EMAIL TITLE";
  var body = `
Dear ${name},

TEXT

-------------------------------------------------------

SIGNATURE

-------------------------------------------------------
  `;
  GmailApp.sendEmail(email, title, body);
  notifySlack(`
<!channel>

You received a Google Form request:

-----REQUEST CONTENT-----
・NAME: ${name}
・EMAIL: ${email}
・PHONE: ${phone}
・OFFICE: ${office}
・COMMENT: ${comment}
-------------------------

`);
}

function notifySlack(message) {
  
  var postUrl = 
"https://hooks.slack.com/services/XXXXXXXXXXX/XXXXXXXXXXX/XXXXXXXXXXXXXXXXXXXXXXXX";
  var userName = "[alert] FORM REQUEST";
  
  var payloadObj = {
    username:userName,
    text:message,
    icon_emoji : ":mega:"
  }
  
  var payloadJson = JSON.stringify(payloadObj);
  var options = {
    method:"post",
    contentType:"application/json",
    payload:payloadJson
  }
  UrlFetchApp.fetch(postUrl, options);
}

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda