Open tusharwagh-mdsol opened 1 week ago
Hi @tusharwagh-mdsol, Your code mostly looks in order, but I notice that you are making your ack
call in the handling for the view submission of reason_model
by submitting view
again, instead of the newly composed view. I'm wondering whether instead of calling the views update method, you instead pass the body of your new view.
Hi @srajiang, Thanks for the quick response. Yes in later part I realised that and I removed that and made only ack() But afterwards I am trying to open a new modal (After one API call) which will confirm if the task is completed or not and this is giving me the same error.
Please note I will need this aprovalresponse to compare the status received from api so I cannot make this api async.
Below is the code for the same.
// Handle submission of the reason modal
app.view('reason_modal', async ({ ack, body, view, client }) => {
await ack()
const viewId = view.id;
// Open a quick loading modal
await client.views.update({
view_id: viewId,
"response_action": "update",
view: {
type: "modal",
title: {
type: "plain_text",
text: ":man-biking:Processing..",
},
blocks: [
{
type: "section",
text: {
type: "plain_text",
text: ":hourglass_flowing_sand: Processing your request... ",
},
},
],
},
});
**//Making One api call here**
// Ensure the post request is awaited
const approvalResponse = await axios.post(approvalUrl, payload, {
headers: {
"Content-Type": "application/json",
"x-api-key": process.env.X_API_KEY,
},
});
**//Below Modal is returning same error.**
// Update the modal with the final content
await client.views.update({
view_id: viewId,
"response_action": "update",
view: {
type: "modal",
callback_id: "modal-1",
title: {
type: "plain_text",
text: "completed",
},
blocks: [
{
type: "section",
block_id: "section-1",
text: {
type: "mrkdwn",
text:"task is completed",
},
},
],
},
});
Okay so in the latest code sample, you are acknowledging the request from slack ack
but not including any response action in the acknowledgement.
It looks like the approach you are taking is to update the view after submission event via API (e.g. https://api.slack.com/surfaces/modals#updating_apis), but please note that response_action isn't a supported property for this method. https://api.slack.com/methods/views.update
Just a couple of troubleshooting questions:
hash
property in your views.update payload? https://api.slack.com/surfaces/modals#handling_race_conditionsHave you tried adding a hash field? See: https://tools.slack.dev/bolt-js/concepts/updating-pushing-views
Hi Team, Need some urgent help on slack bolt JS. I am developing a slack application where user can approve/reject tasks. Platform used to run this code is EKS.
Below is the code I am using to open a modal to provide comment for the action.
And to handle this comment I wrote below code.
But getting an error as below.