TaCode Tuesdays: Add the Ability to Send Text Messages within Your Own Apps

Posted by Pedram Mohammadi on August 9, 2016

tacode-tues-blog-wk3.jpg

Welcome back to TaCode Tuesdays! This is the only place you can find snippets of code for use in your very own text/voice apps, along with a weekly dose of taco puns. I’m a developer here at Zang and not only am I a big fan of tacos (if that wasn’t already apparent), I’m also a fan of open source. My goal is to share a new app idea each week that you're free to use “as is” or modify and use as the basis for your next app—no coding ability required.

Last week I outlined a custom caller ID app that masks your personal phone number when making calls—you can check that out here, and as always, if you’d like to learn how to get started on Zang, take a look at our very first post.

This week I’m going to focus on a simple piece of code for sending an SMS (or a text message). This will enable to you send a text to an individual or multiple people from your Zang number. It’s a simple action, but it's incredibly useful for apps that require any interaction with customers. The reality is that people in general are more likely to read and answer a text message than a phone call.

But before I move on to the code, below you’ll find your taco tips for the week.

Making tacos is usually a pretty simple endeavour, but the bane of my taco-making existence is dropping ingredients. That’s why I now follow some strict taco rules:

  1. Meat placement is key for tacos, it’s usually the heaviest ingredients and the most important! Aim for a quarter to half inch border of open tortilla around the taco and you’ll never lose any of the meat.
  2. Always stick to tacos with a diameter of about 4 to 5 inches. I can promise, after many years of taco-eating, anything bigger and ingredients fall out way too easily.

Let’s Taco ’Bout the Code

You’ll need to have a Zang number (enabled for SMS) in order for the app to work. If you’d like to learn how to set up your Zang number and a document that’ll house the code, check out our first ever post.

So, before we start, here’s how the code works:

  1. Manually enter the number that you like to receive the message, following by the message.
  2. Repeat if you’d like to send to multiple numbers.

Save this document, but keep it open in another tab because we’ll be coming right back to add the Public URL of the next document we’ll be creating. Next, let’s create document #2 or “Custom Caller ID - Part 2”—this is the part of the app that enables you to enter your desired caller ID.

[CODE]

<Response>

<Sms from="" to="555*****"></Sms>

<!--If you’d like to send a message to multiple numbers, you must copy the string of code above for each instance of an SMS-->

</Response>

[/CODE]

There you have it! A simple line of code that you can use within your own app to add the capability to send text messages. If you’d like more info on our SMS capability, check out our documentation—that should give you some ideas on how to expand upon it, then add it to your app.

Well, that’s it for this week! If you have any thoughts about the apps or just want to share your own taco-related thoughts, you can comment below. If you want a reminder, sign up to get notifications of new blog posts. I’ll be back next week with a new post of “TaCode Tuesday,” where I’ll be highlighting even more free code and apps.

Topics: Communication Apps, Ideas, TaCode Tuesday, cPaaS