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

155
Visualizações
Gmail API in python and Gmail App giving different messageId for same message

So watch a tutorial on internet i created a Google App Script(GAS) for getting History id. using previous history ids i created a script which gives message id and thread id for every incoming requests and posts it on my API in function postReq(). Now when i try to use these ids in python gmail api they show error that they dont exist. I tried to get ids for certain messages and found out they are different from those given from GAS. Is this something api does or i can fix this anyway? Thanks

function doPost(e) {
  let message = JSON.parse(e.postData.getDataAsString()).message
  let data = Utilities.newBlob(Utilities.base64Decode(message.data)).getDataAsString();
  let sheet = SpreadsheetApp.openById('...')
  let doc  = DocumentApp.openById('...').getBody()
  let para = doc.getParagraphs()[0]
  let prevId = sheet.getDataRange().getValues()[0][0];
  data = JSON.parse(data)
  let historyId = parseInt(data.historyId)
  let history = Gmail.Users.History.list("nyxgodxd@gmail.com",{"startHistoryId": `${prevId}` }).history
  let threadId = history[0].messages[0].threadId
  let msgId = history[0].messages[0].id
  let msg = Gmail.Users.Messages.get(userId = 'me', id = `${msgId}`).snippet
  let res = {historyId,threadId, msgId,msg}
  para.appendText(`\n${JSON.stringify(res)}\n`)
  postReq(res)
  sheet.getDataRange().setValues([[`${historyId}`]])
  return 200;
}
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