SMS Verifications into Slack without Code!

OTP — one time passwords are a familiar sight these days. You need them for online banking, you need them for 2 factor authentication and you need them for security checks on access to accounts. They are great as you can only gain access to an account if you have the device where the OTP is sent to, often a mobile device.

The problem with OTP however is that if you are working as part of a team, only one person holds that device. If that person is not currently available then a blocker is put on the other member of staff’s work. That is not good and not productive. We found this issue with the work we do at Roomfilla and more specifically with verification for logging in and out of multiple AirBnB accounts. We set out to try and find a solution for this.

The Initial Issues

  • OTP goes to one phone. If someone hasn’t got this phone then none of the team gets the message.
  • Sometimes the mobile device isn’t near the person who has it so making an automation would be great.
  • Choosing where to have the OTPs displayed is a challenge..

The first part of our research led us to services like Twilio and MessageBird. What we were interested in specifically was the integrations that these services have with Zapier. We figured that if we could use one of these services to use a virtual number as the SMS OTP verification on the AirBnB accounts then that would be great. Great in thinking of course! After a few minutes of messing around and getting a virtual number to test with, it slowly dawned on me that you cannot use these for SMS verifications… which sucks as you would think that is a clear use case.

Talking with the MessageBird support and this was confirmed so this was out of the window. Had to keep looking for another solution…

Speaking with a friend about this problem, he mentioned a service called PushBullet which lets you control and send SMS and other things from your computer device. This looked great so I installed it and found they have a Zapier integration (winning!). I had a look at the menu and then found that they only have action zaps when ideally I want a trigger (when the SMS is received).

With this not being possible, I deleted PushBullet and moved on to find another solution. Most of these services do provide API access so I am sure it would be possible to build something with a bit of code magic, but the point of this is to try and build the solution without any code.

At this point I was losing all hope so decided to do what great men do in these situations. Use Google for ‘SMS Forwarder for Android’.

The second result on the list was an app called SMS Forwarder — looks decent to me! Went ahead and installed it. It lets you forward SMS to another number or to an email address. I figured forwarding to an email would be great so set it up. You can also set up rules for the forwarding. The rule I set up was to forward messages with ‘verification code’ written in them.

I did a test and the result looked something like this;

This is great and something which I can work with! One thing for the app, you need to ensure that it runs in the background, you can toggle this setting in settings > battery > app management and then ensure that. If it isn’t running it won’t forward your SMS.

Now with an email. It should be simple to set up the Zap right? Let’s get cracking.

Zapier Integration — 1st Attempt

I always like to visualize in my head the exact steps of the Zap before I create something in Zapier. This was no different so I had a concept of what I wanted and it would be something like this.

  1. Trigger when a new email hits GMail.
  2. Filter the email so it only triggers on the emails I want (in this case I could use a filter that the sender is
  3. Tidy up the text, for this I would use Formatter. The email above is a bit messy and ideally we just want the ‘XXX is your verification code’ part.
  4. Send the resulting text to a Slack Channel.

Steps 1 and 2 are very simple to set up in Zapier and require little to no knowledge to get right. Step 3 is a bit more complex, for this you need to use a regular expression formula. Luckily Zapier now has this built in, you can use the formatter action and hit text and then split text. For the first part I want to remove the New SMS: from the start of the body;

This will now provide me a string without the New SMS: as can be seen here;

The problem with this is that it has all the extra stuff from -Fwded at the end. Let’s clean that up by jumping back into Formatter and using the input as the output from the previous step. We then trigger this to run on ‘-Fwded’ and provide all text before this. Like so;

You can see the output here is successful and exactly what we want!

Great! We can now look at pushing this text directly into Slack where our team communicates. We made a new channel #sms-verifications and used the Zapier action of ‘Send Channel Message’. We will send it as a bot and use a pokeball icon because why not and then send a test and it works! We did some further testing and it works..

But there is one issue… the Zap doesn’t trigger instantly and can be up to 5 minutes to trigger. This is going to slow down the workflow slightly. How to fix this? With an instant trigger of course!

Zapier Integration — 2nd Attempt

The workflow we made above works. It does the job but is slightly delayed which is a bit annoying. If only we could have it to trigger instantly. Slack has trigger steps on Zapier which work instantly, this means that you can pretty much create a word that will trigger the Zap. So… we got to work. The workflow we wanted would be something like this.

  1. If someone types REQUEST OTP into the #sms-verifications channel — trigger the zap.
  2. Find an email in the inbox with the filter (of the sender)
  3. Do the formatting text that we did previously.
  4. Spit the text out to Slack.

First step is easy enough to set up;

Remember to create a filter here though! If you do not it will just trigger on any message in the channel. This is how we did the basic filter;

Perfect, now it only will trigger if someone types REQUEST OTP. Something people are unlikely to say normally.

For the email part, things remain largely the same, except we will use the SEARCH email instead of the new email in inbox. This is fine and works the same. We can then set up the filter here to only action if the sender is the same as specified in the other zap.

The Formatter text is exactly the same as the above to set up and finally the action to send the message to Slack is the same. We then turned this on to do some testing.

It works! and is instant. When a member of our team gets an OTP screen on AirBnB, they can now request the SMS. They will then know to go to Slack and hit REQUEST OTP and the OTP code will appear.

Hope you have made it this far and have enjoyed this. I hope to create more content on how we have hacked together various tools with zero code to create a more automated and connected workflow in the future.