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.
- 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
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.
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.
Extract an attachment from Slack user messages
You can extract message attachments from messages sent by other Slack users in your workspace 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.
-
In the Set up trigger section:
- Click the Channels dropdown menu and select the channel you want to trigger from.
- Click the Trigger for Bot Messages? dropdown menu and select No.
- Click Continue.
- Click Test & Review. If the step is successful, you’ll see sample data from your recent Slack messages.
- Click Continue.
If you select No from the Trigger for Bot Messages? dropdown menu, you won’t see info about the message attachment.
2. Add a Delay step
You must add a 1 minute delay to your Zap. This allows enough time to extract all message attachment info.
- In the Zap editor, click to open the Action step.
- In the Choose app & event section, search for and select the Delay app that will trigger the Zap.
- Click the Event dropdown menu and select Delay For.
- Click Continue.
-
In the Set up action section:
- Time Delayed For (value): 1
- Time Delayed For (unit):Select minutes.
- Click Continue.
- Click Test action.
3. Add a Slack Find Message step
- In the Zap editor, click to open the Action step.
- In the Choose app & event section, search for and select Slack.
- Click the Event dropdown menu and select Find Message.
- Click Continue.
- In the Search Query field, map the permalink field from step 1. This field identifies your Slack message.
- Click Continue.
- Click Test action. If the step is successful, you’ll see sample data from your Slack message in Step 1. If the message contains attachments, the sample data will include an attachments field.
- Click Continue to finish setting up your Zap.
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.