Hey there.

Welcome to my blog. I document my adventures in startups, workflows, automations and whatever else. Stick around if you wanna see how a non techie, tries to be technical!

Peace out!

Do a Google Search from Slack!

Do a Google Search from Slack!

Everybody loves going to a search engine when something doesn't make sense. If you aren't already at your browser though you may be thinking... hey, how can I speed up my workflow and ensure I can limit my time spend? Well today I introduce you a basic workflow which will allow you to search within Slack. 

I know, I know.. first world problems. This is something which doesn't really solve much problems but it does speed things up! The benefits from what I could see were the following;

  • Easily create a search in slack, spit out a URL and click it... hello efficiency!
  • Slack is usually where you talk with your team. Being able to share a search with your team is incredibly powerful
  • Everybody loves a Slackbot right? #amiright

The initial outline

Ok, so we want to do a search in slack and then get a Google URL. How would we go about this? Well of course, the workflow will be something I will share below. This is what I want to happen;

  1. Go to a specific slack channel
  2. Write 'search <thing you want to search>
  3. A bot will send a message with the URL of the search which you can then click

I told you it wasn't difficult right. So let's get cracking. I guess it makes sense to try and figure out how Google searches look and understand the URL... let's search for sausage and beans for jokes... 

 

Screenshot 2018-03-01 02.18.49.png

A casserole recipe! Well... that looks tasty but look at the top... look at that horrendous URL. Incase you can't see it, it looks like this - https://www.google.co.th/search?dcr=0&source=hp&ei=eACXWoeOOIzcvgSIwYy4Dg&q=sausage+and+beans&oq=sausage+and+beans&gs_l=psy-ab.3..0l10.2521.4349.0.4456.20.17.0.0.0.0.146.1567.9j6.16.0....0...1.1.64.psy-ab..4.15.1567.0..0i131k1j0i10k1.87.t-_Jvn3kfjY

Not too much of a fan of all that source and following information. Just want something to work and don't really want to get the Google suggestions... I just want the things that work... I think it is time for a pivot!

The pivot

All the cool kids pivot right? This is mine. Time to use DuckDuckGo. It is like Google but without all the tracking and annoying cookies and other non-edible joke things. If I do a search on DuckDuckGo what do I see? Oh! Oh! This is something I can work with.

 

More importantly to this is the URL. The URL is https://duckduckgo.com/?q=sausage+and+beans. This is easy and easy to work with. So the string that we need to create is whatever we want to work with + instead of the spaces and we just need to attach the whole lot to the end of duckduckgo.com?q=<SEARCH+HERE>. 

Putting it all together...

like a great sausage and beans casserole.. anyone else hungry by this point? Ok stop messing around. This is a super simple process with Zapier. Let's get started!

Step 1 - You will need to go create a new zap and have Slack as the trigger. Choose post message to a channel and choose which channel you want this to work on. I chose #random because we never use it. 

 

Step 2 - We want this to only trigger if the message starts with search. This will mean that if the message is anything else then it won't trigger the action. You can do this by setting up a filter. 

 

Easy life that worked! Now to split the text so that you can add it to the search for DuckDuckGo. For this you need to use the formatter tool. First we need to split the text.

Step 3 - Make a Formatter action and then choose the split text function. You want the formatter to return everything after the 'search ' in the message. Very easy to set up like this;

 

 Works great and gives the output of 'sausage and beans'.

Works great and gives the output of 'sausage and beans'.

Now that we have sausage and beans I think there is an end to the journey but one more formatter is needed. We said earlier that the DuckDuckGo search uses + instead of spaces. So this time we want to use the replace function. 

Step 4 - Open formatter use the replace function and make sure you use it based on the last output as that is the text we need to manipulate now. Use the replace function and replace the spaces with +. Very simple and your output should look like this;

 

Screenshot 2018-03-01 02.35.41.png

Yehaw! Now to add the last step which is to push this all back into the #random channel in Slack with the search term. For this you will need to use a Slack action.

Step 5 - Make a new channel message in Slack and choose what you want it to say. For this example I will make it say 'Click here to see that search! <SEARCH LINK>. Easy way to finish off. I will make it send as a bot and my bot will be Bulma from DBZ because why not...

Turn the zap on and you are now ready to search in slack. Let's have some fun. 

 

Screenshot 2018-03-01 02.40.18.png

 

Hey presto! You have built a basic bot into Slack which will understand your message and provide you with a search URL for whatever you need. Wasn't that easy!

Splitting Webhooks like a Pro!

Splitting Webhooks like a Pro!

Send SMS from Slack!

Send SMS from Slack!