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

273
Visualizações
Slack API keeps telling me channel_not_found when attempting to upload an image

Like the title describes, i can't seem to figure out how to upload a local image and have it posted as a message in slack

Currently i am able to post text messages to slack without issue using the webhook url and axios post seen here:

const res = await axios.post(url, {
    text: 'Screenshot',
    channel: channelid

}, {
    headers: {
        authorization: `Bearer ${token}`
    }
});
    

Heres the part of the script that isnt working:

try {

    const result = await client.files.upload({

        channels: channelid,
        initial_comment: "this is the image",

        file: fs.createReadStream(fileName)
    });

    console.log(result);
} catch (error) {
    console.error(error);
}

I dont understand how the channelid works in one and not the other.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Calling a method with an xoxb or xoxp token is different than posting a message with a webhook. When you create the webhook on the Slack Developer settings site, you are asked to choose a channel. The webhook will be able to post into that channel without your app being a channel member. When using the xoxb token your bot needs to be a member of the channel that's being passed in the API call. If it's not a member you can expect a channel_not_found or not_in_channel error.

about 4 years ago · Juan Pablo Isaza Relatório
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