Extracting an attachment from Slack messages

You can use Slack's New Message Posted to Channel trigger to extract message attachments in public Slack channels.

Message attachments include shared links and content previews. They are preceded by an indentation from other messages.

76bb3463d1fd287e87446facaad6d342.png

miscEye icon Note
  • Zapier can only trigger on non-ephemeral attachments that appear to all users in a channel or direct message.
  • This feature is only available for trigger steps, not actions.

You can extract message attachments from:

  • Slackbot messages
  • Messages sent by Slack users
Slackbot messages Messages sent by Slack users

Extract an attachment from Slackbot messages

You can extract message attachments from Slackbot messages to use in subsequent Zap steps.

1. Add a Slack trigger step

  • In the Zap editor, click to open the Trigger step.
  • In the Choose app & event section, search for and select Slack.
  • Click the Event dropdown menu and select New Message Posted to Channel event that will trigger the Zap. 
  • In the Set up trigger section:
    • Click the Channels dropdown menu and select the channel you want to use.
    • Click the Trigger for Bot Messages? dropdown menu and select Yes.
  • Click Continue.
  • Click Test & Review. If the step is successful, you’ll see sample data from your recent Slack messages.
  • Click Continue.
miscEye icon Note

If your bot doesn't post any text with the attachment, the first attachment's text will become that message's text. We'll include attachment details in the response as well.

2. Add a filter step

Add a filter step, so the Zap only continues if a Slackbot message triggers the Zap.

  • In the Zap editor, click to open the filter step.
  • In the Filter setup & testing section:
      • In the Choose field, select the Slack User Name field.
      • In the Choose condition dropdown, select (Text) Exactly matches
      • In the Enter text or insert data, write the name of the Slack Bot.
  • Click Continue. Based on the selected trigger sample, you can test if your Zap would have continued under your filter conditions.
  • Click Continue to finish setting up your Zap.

Now, you can map your Slack attachment fields in your remaining action steps. Learn more about using Slack in the Zapier Community.

miscEye icon Note

  • Info from the attachment field will vary. Learn more about when Slack previews won't display.
  • If your bot doesn't post any text with the attachment, the first attachment's text will become that message's text. We'll include attachment details in the response as well.

 

Now, you can map your Slack attachment fields in your remaining action steps. Learn more about using Slack in the Zapier Community.

Was this article helpful?
1 out of 10 found this helpful