How to Coda Calling and Texting?
Set up calls and send messages directly from a doc
The basic logic of dealing with phone numbers is turning them into a hyperlink. For calling we make use of “tel” and for texting “sms”. We glue these together using a Format()
or Concatenate()
function with Hyperlink()
and off we go. Or not? Well actually not directly and I quote:
Throughout the world, every country has a country code list that is unique, making it easy to place calls anywhere in the world to any other county. However, before you dial international calling codes, you need to notify the telephone system by including all the appropriate information.
We thus not only need to take care of the elements ‘tel’ and ‘sms’, but also of the number related to the country of the recipient. For these we need country codes, like below.
Once we have these prefixes, we get closer:
- Dial the IDD, which for majority of the world is 00 or 011.
- Add the country code from the country code list.
- Then dial the target number, leaving off the first zero if there is one.
With these ingredients we can make it work.
NB if you set up a new table like the one below, do you notice the format of the column in which I put a number?
Indeed it turned automatically into a number column and so the zero I typed before the 4 is gone, at least in the view. Although this might turn out handy later on, for most users this is confusing. You type a phone number and you are served with a stripped version. That feels wrong, doesn’t it?
We turn the column manually into a text column and the zero is back in the view. We also pulled in the prefix.
We made the deliberate choice to have a user friendly solution and this includes a zero in the view. Under the hood we strip this zero away:
If(thisRow.[phone number].Slice(0,1).Contains(0),thisRow.[phone number].Slice(2),thisRow.[phone number])
What about the 00 versus the 011
Well happily for us the exit code of any country can be replaced with a plus symbol according this source. That makes it easier, we do not have to format the numbers into something like 0032 but we can add + 32 and off we go. This plus also works for calling to the USA from Belgium and to Germany when you are in the USA.
If you see an international number that has a plus sign before the country code you either dial + or replace it with your country’s exit code. Both methods work.
With the basics lined up, we can start calling and texting!
We first dive into texting assuming we understand already the set up of the number, which we explain for good reasons at the end.
SMS via Coda
An SMS has two important elements, the number (as shown above) and the text message. In the community you find a way to handle this:
When I had to make a delivery for my former Tea Trading business, text messages came in handy because I could type the message in a table, go to the Coda app and select the message for sending. This was way handier than typing on my mobile.
The Format Function
To make texting work, we apply the function Format()
for two reasons. First it is a function that permits you to separate variables from non variables (like text and numbers) in a structured manner. Once you see the logic, this one reads easier than Concatenate().
Second and not less important, this function permits you to format your function in two ways. Using hard returns you create white space in your text without the need of Character(10)
. This is very convenient. However, often you see it as below whereby behind the double dot you find the instructions for the amount of digits you want to see.
Both ways of formatting are practical and I grantee you that once understood, you apply them often.
Format(“On {1} {2:00}”,Month,Day)
We use in this example mainly the ‘white space trick’ to create readable texts. To get there we take a few steps.
We split the body text into three parts, the salutation, the message and the ending. Below how I made use of the white space logic to get UX friendly results.
The main part is the free text. Here you type your main message. We integrate this part in the column with the fancy name ‘TheMessage’
We use Format()
as promised and start with the instruction, it concerns a , SMS and second we take the full number. So far so good, but from here it asks for a bit of creativity. We turn the whole thing into a URL with body text and thus we add this tiny part as variable 2. The following steps are straight forward, we take the message parts, we encode them all for URL to take care of white space and special characters and once done we turn the string into a hyperlink. That is it!
Once you see this example, it is simple, right? Okay, we agree on this and the only part left is how to turn a phone number into something Coda understands and works on your phone?
Calling
Since you have seen how the format function is working, this one goes rather fast. Don’t pay attention to the outer if statements, they are just there to make it look nice. However the if statement on the inside that generates the FullNumber does matter as explained previously. This one strips the zero away in case there is one. This is variable 2. The prefix you have seen before and the ‘ + ‘ replaces the complexity of the 00 or 011. I put a white space between the prefix and the number as you can see, that reads better and with the format function, this is so easy!
We glue it all together and we are almost done. The last part in the column ‘Number to Call’ is the Hyperlink()
that contains the ‘tel:’ and FullNumber.
Making use of this knowledge you have solved an important part of the puzzle. The one about calling directly from a Coda doc. Try it out, you’ll be surprised.
I hope you enjoyed this article. If you have questions feel free to reach out. Though this article is for free, my work (including advice) won’t be, but there is always room for a chat to see what can be done. Besides you find my (for free) contributions to the Coda Community and on Twitter
My name is Christiaan Huizer and I am the owner of Huizer Automation. A company specialized in serving SME in harvesting data and keeping it aligned. I am a Coda Expert and rely mainly on Coda, Mailjet, Zapier & Paperform to get the job done.