I'm trying to create a bot which will send image with a 'send' and 'change' button to a user when slash command will be used by user.
So, when user clicks change, I want to change image in that response and, when send is clicked, I want to send that image from that user's side.
Currently, I'm using respond method available in the slash command request but when I'm listening to that action I'm unable to find that message and delete, If there is any other way to implement this functionality then please correct me.
Here is my code for listening to slash command:
const slashCmdRes = asyncHandler(async ({ say, ack, respond, body }) => {
// Acknowledge the command request
await ack();
try {
const meme = getrdmMeme();
console.log('body :- ', body);
const photoModel = slkPhoto(meme);
const res = await respond(slackModel(photoModel, slkActionBtn));
// const res = await respond({
// "response_type": "ephemeral",
// "text": "Sorry, slash commando, that didn't work. Please try again."
// });
}
catch (error) {
console.log("error", error);
await respond("server cant'listen \n Please contact memebiz customer support");
}
})
Here is my code for listening for action in that response:
const actionResponse = async (req) => {
console.log("body", req);
await app.client.chat.delete({
channel: req.body.channel.id,
ts: req.body.container.message_ts,
as_user: true
})
}