Sending Slack Messages with Block Kit in Bot Framework V4
Jose Antonio Gonzalez Rodriguez
0
Reputation points
I'm currently using Bot Framework V4 and have successfully connected to a Slack workspace. I can interact with my bot synchronously. However, I'm trying to send an asynchronous message using continueConversationAsync
, which works correctly when sending just a string, allowing the message to appear on Slack.
I've referred to this guide: Create a full-fidelity Slack message, but it utilizes the old method with attachments. Slack recommends using Block Kit.
Here’s how the activity being sent to Slack currently looks, but I'm not receiving the message:
const activity = {
type: 'message',
channelData: {
blocks: [
{
type: 'header',
text: {
type: 'plain_text',
text: slackAttachment.headline,
emoji: true,
},
},
{
type: 'image',
image_url: slackAttachment.imageUrl,
alt_text: slackAttachment.headline,
},
{
type: 'section',
text: {
type: 'plain_text',
text: slackAttachment.message,
emoji: true,
},
},
],
},
} as Partial<Activity>;
await context.sendActivity(activity);
Sign in to answer