Best answer

How do I set a Zap to ONLY trigger when a Slack uploaded file also has a text message?

  • 22 January 2024
  • 4 replies
  • 55 views

Userlevel 3
Badge

It seems I can do one but not the other… what I am I missing?

I want a Zap to trigger when:

  • I upload a Slack file.
  • There is ALSO a Slack text message with certain words that accompanies the file, since Slack allows that.

How do do both of these things? When I go to the file attachment trigger, I don’t see a place for a text message, and vice-versa. 

icon

Best answer by SamB 1 February 2024, 16:24

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

4 replies

Userlevel 3
Badge

From the other thread:

I see I can do a Zap trigger for Slack that is “New Message Posted to Channel” OR “New File”.

I want to do both, meaning:​​​​​ the message must have a file attached AND has a text message (I will use a Filter so it only passes along files with some messages).

But in the Trigger parameters (and I looked in the Filter too), it seems to be one OR the other, not both. “File” Data is not available if I choose New Message, and vice-versa. 

Does anyone know a workaround?

Userlevel 7
Badge +11

Hey there @TORLEY

I did some checking and it looks as though the New Message Posted in Channel trigger does contain the file details, but only if the file is attached (uploaded) to the message:

cee029bc717492999214beffba4055b5.png

So for those instances you could use that trigger along with a filter as to ensure it only continues for messages that have a file attached.

But if a url is used in the message to embed a preview of the file then it won’t be picked up as a file attachment. In which case you may need to get the filter to also check the content of the message to see if it contains a file link. For example if “<https://docs.google.com/document/” is present in the message text then a link to a Google Doc will have been added to the message. 

If you need to extract the file URLs then you might want to try using a Formatter or Code action, to extract the URLs. You can learn more about how to extract urls using Formatter here: Extract URL. If you’ve got multiple different types of file links that might be added the it might be better to use a Code action for handling the extraction. It’s a bit more advanced but we have an AI feature that can help to generate the necessary code for you. See our Generate a Code step using AI (Beta) guide for more details on that.

Hope that helps to get you pointed in the right direction. If I’ve misunderstood what you’re looking to do here or you need any further help on this just let us know! 

Userlevel 3
Badge

@SamB This is great and very comprehensive help, which I am grateful for. I hope your clearly-explained steps and screenshot help someone else.

What I had to do is redo “Find new records” right after I had Slack’ed a message that DID have a file attachment, exactly like you pointed out. Then the expected input shows up.

ABOVE AND BEYOND! YOU ARE AWESOME!

If this helps someone else, please share. 🙌

Userlevel 7
Badge +11

That is awesome news, @TORLEY! 🎉🎉🎉

I’m so glad my reply helped you to get this sorted. Seems like you’re all set for the moment but as ever, do let me know if I can assist with anything else at all! 🤗