3
votes

I've created a POC app using a Twilio trial account to connect to the Twilio API to download SMS messages. The end goal is to be able to write test automation against web application behind Google MFA.

The code works and downloads SMS messages, but it does not return any texts I've forwarded from my own phone that contain Google verification codes. I can forward other messages or send new messages to the Twilio account and they get returned. But nothing from Google. I also found if I removed the G from the code, it went through OK as well, for example sending 465720 instead of G-465720.

If you're curious, this is the code:

            WebRequest req = WebRequest.Create("https://api.twilio.com/2010-04-01/Accounts/AC################################f/Messages.json");
            req.Headers.Add("Authorization", "Basic [REDACTED]==");
            WebResponse resp = req.GetResponse();

            Stream data = resp.GetResponseStream();
            StreamReader sr = new StreamReader(data);

            string msgData = sr.ReadToEnd();
            TwilioResponse tResponse = JsonConvert.DeserializeObject<TwilioResponse>(msgData);

            content = tResponse.messages[0].body;
1
How are you fowarding the Google messages to your Twilio number?philnash
I've seen this behaviour too. Did you get any updates at all?Dave Lowe
@philnash, I set up the test account to use the Twilio number.Kevin McDowell
@DaveLowe, Yes. due to some agreement with them, Twilio blocks SMS short codes from both Google and Facebook. As an alternative, look at bandwidth.com.Kevin McDowell

1 Answers

3
votes

Yes, Twilio blocks SMS short codes from both Google and Facebook because they have an agreement only to send to actual mobile numbers. See this article for more information: https://support.twilio.com/hc/en-us/articles/223134367-Sending-messages-from-Facebook-and-other-services-to-Twilio