Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

106
Vistas
How to respond to view after submitting the view in slack with bolt js

Hi I've implemented one simple shortcut to get data from input but after submitting the view I couldn't get the response payload or it cannot update the view to acknowledge user. following is my simple code.

const { App } = require("@slack/bolt");
const app = new App({
  token: process.env.BOT_TOKEN,
  socketMode: true,
  signingSecret: process.env.SIGNIGN_SECRET,
  appToken: process.env.APP_TOKEN,
}); 
app.shortcut({ callback_id: 'open_modal', type: 'message_action' }, async ({ shortcut, ack, client }) => {
  try {
    await ack();
console.log("Ack:")
    
    const result = await client.views.open({
      trigger_id: shortcut.trigger_id,
      callback_id: "new-task-modal",
      view: {
        type: "modal",
        title: {
          type: "plain_text",
          text: "My App",
        },
        submit: {
          type: "plain_text",
          text: "Submit",
          emoji: true,
        },
        close: {
          type: "plain_text",
          text: "Cancel",
        },
        blocks: [
          {
            "type": "input",
            "element": {
                "type": "plain_text_input",
                "action_id": "plain_text_input-action"
            },
            "label": {
                "type": "plain_text",
                "text": "Label",
                "emoji": true
            }
        }
        ],
      },
    });
  } catch (error) {
    console.log(error);
  }
});
app.view({ callback_id: 'new-task-modal', type: 'message_action' }, async({ shortcut, ack, view, body }) => {
  try {
    console.log("New task modal",view.state.values );
    await ack();
    
        let result = await client.views.update({
          view_id: body.view.id,
          view: {
            type: "modal",
            title: {
              type: "plain_text",
              text: "My App",
              emoji: true,
            },
            close: {
                type: "plain_text",
                text: "Cancel",
              },
            blocks: [
              {
                type: "section",
                text: {
                  type: "plain_text",
                  text: "This is a plain text section block.",
                  emoji: true,
                },
              },
            ],
          }
        });
    
  } catch (error) {
    console.log(error)
  }
})

app.shortcut() function works fine and create one view but after submitting that view it couldn't hit to app.view() function to update the view so is there any way to update the current view.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda