DEV Community

dev.to staff
dev.to staff

Posted on

Twilio Hackathon Help Thread

The awesome Twilio team will be making themselves available to help people who runs into issues or have questions related to their products as part of the Twilio Community Hackathon.

You are encouraged to comment in this thread for asynchronous assistance. We've also set up a dedicated DEV Connect group channel for more synchronous help. To join the Connect group, just leave a comment in this thread asking to be added.

Twilio will be hosting office hours in Connect during the following times:

  • Mondays: 3-6pm EDT
  • Tuesdays: 3-6pm UTC
  • Wednesdays: 3-6pm AEDT
  • Thursdays: 3-6pm PDT
  • Fridays: 3-6pm EDT

Additionally, Twilio will be hosting a weekly office hours session on https://twitch.tv/twilio, starting on April 2 at 4-6pm PDT.

If you'd like to share more general progress that you're making on your project, you can do so in the community update thread!

Top comments (136)

Collapse
 
technoplato profile image
Michael Lustig - halfjew22@gmail.com

Request for async assistance:

Can someone help me out here?

I'm using this library to download a video: github.com/fent/node-ytdl-core

I need to save the video to a file in order to make some modifications. I'm having trouble saving the response of the call to download a video without using the piping operator.

I think the read call is returning a byte array, but can't tell from the method signature. Could someone point me in the right direction here?

  const readable = ytdl(shortVideoUrl);

  await new Promise(res => {
    readable.addListener("readable", () => {
      console.log(`index::20: entering`);
      const foo = readable.read();
      if (!foo) {
        console.log(`index::23: no here`);
      }
      console.log("index::21: foo.length:", foo.length);
      const file = fs.createWriteStream("shortvid.flv");
      file.write(foo);
    });
  });

Alternately, if there is a way to get information about the progress of the write when using the pipe operator, that would be great too. Thanks!

Collapse
 
philnash profile image
Phil Nash

To get info about the progress it looks like you can listen to the progress event on the readable. Something like:

readable.addEventListener('progress', (chunkByteLength, totalBytesDownloaded, totalBytes) => {
  console.log(`Downloaded ${totalBytesDownloaded} out of ${totalBytes}`);
})

I haven't used this library though, so I might be wrong. Hope it helps!

Collapse
 
technoplato profile image
Michael Lustig - halfjew22@gmail.com

Hey Phil thanks a lot for the reply. That definitely works if I wasn't using the pipe operator, but without doing so, I don't know how to create the file from the array of bytes.

At any rate, I actually switched to Python and it's made my life a little easier.

Thread Thread
 
philnash profile image
Phil Nash

Ah! Because it's a readable stream it will emit the data event with chunks of the data which you can write into your writable stream. Something like this should work:

const file = fs.createWriteStream("shortvid.flv");
const readable = ytdl(shortVideoUrl);
readable.addEventListener('data', chunk => {
  file.write(chunk);
});
readable.addEventListener('progress', (chunkByteLength, totalBytesDownloaded, totalBytes) => {
  console.log(`Downloaded ${totalBytesDownloaded} out of ${totalBytes}`);
})
readable.addEventListener('end', () => {
  file.end();
});

But, if you've switched to Python and you're happy with that, then that's cool too!

Thread Thread
 
technoplato profile image
Michael Lustig - halfjew22@gmail.com

If only the Twilio dev evang team could answer all of my Javascript queries šŸ¤£

So just for my learning opportunity here - when you call file.write(chunk), it's appending those bytes to the file, and calling file.end() will close that file write stream and result in the video file automagically?

Side note about python: It's been awesome to stand up my hack. The last step of adding a message queue (which I thought would be the hardest) has been the easiest. Gotta love learning!

Thread Thread
 
philnash profile image
Phil Nash

Yes, that is the gist of it! Using the data and end events of the readable and calling write and end of the writeable is actually the equivalent of using readable.pipe(writeable). But, the documentation suggests you don't want to mix pipe and event based operations and using the progress event would mess that up.

I'm happy to answer JS questions if I can! I just happened to work with other readables/writeables a couple of weeks ago, so it was sort of fresh.

It's good to hear that the Python version has come on nicely for you. I love hackathons for the learning potential!

Thread Thread
 
technoplato profile image
Michael Lustig - halfjew22@gmail.com

Brilliant! Well I followed you so be expecting some in the future.

Python for whatever reason (or perhaps the competitive nature of the Hackathon) has me more excited about developing than Iā€™ve been in a while, so thanks for that!

And thanks again for your assistance.

Collapse
 
gyocran profile image
gyocran

Hello. I'm in need of asynchronous assistance. I just created a Twilio trial account for the hackathon but was greeted with this message when redirected to my dashboard:

"Your account has been suspended due to suspicious activity. Please check your email or submit a ticket with your name, use case, and link to your business and we will review your account."

I am not sure what I did wrong and I need some direction before taking any course of action. Can anyone help? Thanks in advance.

Collapse
 
philnash profile image
Phil Nash • Edited

Oh no! Sorry about that. Our fraud detection does hit the occasional false positive.

If your account has been suspended you will have received an email from our fraud team with more information and a number of questions. The best course of action is to reply to that email and answer the questions. That will give the fraud team more detail and allow them to unlock your account.

Collapse
 
gyocran profile image
gyocran

I have submitted a ticket and sent you an email containing my Account SID. Thanks so much for help

Thread Thread
 
philnash profile image
Phil Nash

I think you're back up and running now. Good luck building your hack!

Thread Thread
 
gyocran profile image
gyocran

Yes I am Phil! Thanks for your help. I appreciate it.

Collapse
 
dev00114 profile image
Dev00114

Hi, Nice to meet you.
I got the same issue.
Please check my image, let me know your answer

Thread Thread
 
philnash profile image
Phil Nash

Hey, Iā€™m not sure what image you mean here.

If your account has been suspended you will have received an email from the Twilio fraud team with some questions. You should respond to that email and answer the questions, that will help the team unlock your account.

Collapse
 
vanotis720 profile image
Vanotis720

hi Phil! I replied to the email with the answers to all the questions but it's been a few days that my account is still unblocked

Collapse
 
leenliz9 profile image
Leenliz9

hello Phil, I too have been suspended from twillio with the same message of suspicious activity. I have already submitted a ticket to support. I will send you my account SID via email if thats ok?

Collapse
 
brunooliveira profile image
Bruno Oliveira

Hi :)

A somewhat urgent request:
I bought a phone number from the Netherlands (country where I am) and I can send SMS for Netherlands numbers and Belgian numbers (I have a belgian number).
However, my parents (who are in Portugal) tried to use it with a portuguese number (+351 prefix) and it throws an error telling me the number doesnt have permissions?

TwilioRestException: HTTP 400 error: Unable to create record: Permission to send an SMS has not been enabled for the region indicated by the 'To' number: +351.

Any help will be very appreciated!!

Collapse
 
philnash profile image
Phil Nash

Hey Bruno,

What you need to do is go to your Twilio console, to the Geographic permissions for SMS section and ensure you have the permission checked for sending to all the countries you want to.

Collapse
 
brunooliveira profile image
Bruno Oliveira

Hey Phil!
I'd like to let you know that my parents successfully managed to use my web app from Portugal, and got their restaurant info via SMS, flawlessly :D As per your suggestion, just edited the geographic permissions!

Feels great to build my first deployed, location-based web app, all enabled thanks to your API, so, props :D

Thread Thread
 
philnash profile image
Phil Nash

That's awesome! I love that feeling of a job well done. Don't forget, the API was there, but you had to put everything together. Good luck in the competition!

Collapse
 
brunooliveira profile image
Bruno Oliveira

Thanks Phil! I'll try to fix it! By any chance did you read my post about my app and is it a valid submission?

Thread Thread
 
philnash profile image
Phil Nash

It looks like a valid submission to me! As long as it's open source and you followed the other parts of the submission process then you're looking good.

Thread Thread
 
brunooliveira profile image
Bruno Oliveira

Awesome! Thanks

Collapse
 
abreezasaleem profile image
Abreeza Saleem

Hi. I'm trying to use the whatsapp api but when I send a (one-way) message, it gives me the following error:

"The 'From' number +1669******* is not a valid phone number, shortcode, or alphanumeric sender ID."

But my number is a valid 10-digit verified number that's working fine for the sms api. Can someone help me out here?

Collapse
 
philnash profile image
Phil Nash

If you are using the WhatsApp API then you need to send the message from a WhatsApp number. WhatsApp numbers are prefixed with whatsapp: too.

Check out the WhatsApp sandbox in the Twilio console and try again with the WhatsApp sandbox number.

Let me know how you get on.

Collapse
 
abreezasaleem profile image
Abreeza Saleem

Thank you so much for your reply. I already tried that in my terminal but then I get the error:

Twilio could not find a Channel with the specified From address

I am also providing the authorization token and accountSid.

Thread Thread
 
philnash profile image
Phil Nash

Have you been through the full WhatsApp sandbox setup?

Thread Thread
 
abreezasaleem profile image
Abreeza Saleem

yes.

Thread Thread
 
philnash profile image
Phil Nash • Edited

Can you share the code you're using? My DEV connect chat is open if you want to share that privately or in more real time.

Collapse
 
alessandrojcm profile image
Alessandro Cuppari • Edited

Hi there Twilio team!

The app that I'm building uses Autopilot along with the Whataspp API channel, so I have a couple of questions:

1) Can I have two fields in a collect action question? I.e, the very first question my bot asks is for the user's first name, it goes "Can I have your name" with a yes/no question if the user says yes then it redirects to the actual action which saves the name. But I think this isn't too organic, I would like to narrow those two questions down into one, so the bot asks "Can I have your name?" and then the user could reply "no" or something like "yes I'm name here"; I've seen some examples about custom fields but either they are too old or they do it via the console instead of with the json schema, which is why I want.

2) The API I'm building for the app relies heavily on the UserIdentifier being present (since it's the primary key I'm using to store the users) so, is there I way I can set the UserIdentifier in the Autopilot simulator? Currently, I'm testing with my phone via Whatsapp, but it would be much better to do it in the simulator with the debug view and all the details.

Thanks!

Collapse
 
alessandrojcm profile image
Alessandro Cuppari • Edited

Hey Dominik, I have another question for you šŸ˜…

Can the routes taken by the bot to trigger tasks be constrained?

For example, say I have a menu task; which lists all of the bot's functionalities. I want all of those tasks to only be triggered from that menu action, kinda like a finite state machine; where states can only be triggered by another given state. Currently I'm using the listen action with the tasks sub-property; but still, there are actions that trigger when they're not suppose to.

Collapse
 
dkundel profile image
Dominik Kundel

Hi Alessandro! I reached out to our Autopilot team to get you an answer to those questions. I'll try to get back to you as soon as possible.

Collapse
 
alessandrojcm profile image
Alessandro Cuppari

Cool Dominik, thanks!

Thread Thread
 
dkundel profile image
Dominik Kundel

Alright I got some answers for you :)
For your first question, you cannot collect multiple types at the same time but there is a workaround using "prefill"s. You can check them out here: twilio.com/docs/autopilot/actions/.... You could take that to extract the initial values for multiple fields and then it only collects the missing ones.
As for the useridentifier there's unfortunately no way to change it :(

Thread Thread
 
alessandrojcm profile image
Alessandro Cuppari

Cool, thanks I'll check it out the link. About the UserIdentifier, don't worry I think I can implement some sort of middleware to add that data to the incoming request when debugging.

Collapse
 
mia01 profile image
Mia

Hi I'm having an issue when I try to apply the hackathon promocode on my twillio trial account. I'm getting the following error "Error Promo code is not available for your account." I've followed the steps shown here: twilio.com/blog/apply-promo-code

Please help!! :)
Also can I get added to the DEV connect channel
Thanks!

Collapse
 
shaijut profile image
Shaiju T • Edited

Some questions: šŸ˜„

  1. What if two people accidentally does the same project who willl win ?

  2. Is demo link mandatory ? Because I need to find a free hosting provider to host .NET app. Other option is that I can run the project locally and record the demo as video and post in YouTube, so twilio team can watch the demo ?

  3. Your project should not have security vulnerabilities or violate security best practices (i.e. hard coded credentials, plain text passwords)
    According to The above statement. it means even we cannot store twilio or other API key in our app ?

  4. I need to convert 300 words to speech. i.e I would send that 300 words to twilio voice api and it should return the speech output in a url so I can play it in a browser. if this is possible, Kindly send me documentation demo for .NET.

Collapse
 
dkundel profile image
Dominik Kundel

Hi @shaijut

  1. If it is the same idea but different implementations we'll still judge them as normal. If it seems like it is 100% identical we'll have to see if we can determine who built the original one

  2. Demo link is not mandatory as long as the README has clear instructions on how to run the project locally.

  3. You should store your credentials as environment variables for example or whatever is the right solution in your respective programming language. Here's an example how to use secrets in .NET twilio.com/blog/2018/05/user-secre...

  4. The voice API is largely designed for phone calls and not directly for speech to text. We do have speech to text built-in though. There are some examples here: twilio.com/speech-recognition

Collapse
 
technoplato profile image
Michael Lustig - halfjew22@gmail.com
  1. Not a judge but I'd imagine they're examining all relevant criteria. You need to make sure to follow all of the instructions and do your best. If one application is the same as another, but the latter has better documentation, architecture, tests, etc, I would image it would win.

  2. Check out Ngrok

  3. I'm interpreting that the same as you are.

  4. I think the spirit of the hackathon is to go out and try and find things yourself, post what you've found and tried, and then if you can't find anything, ask for help. Have you looked anywhere at the Twilio docs?

Collapse
 
shaijut profile image
Shaiju T

Hi šŸ˜„, I have used Ngrok before good idea. Thanks.

Collapse
 
Sloan, the sloth mascot
Comment deleted
Collapse
 
shanecurran_35 profile image
Shane Curran

šŸ™Œ All of us at evervault are more than happy to help out with any questions you might have or help you might need to get up and running with evervault auth. Just drop us a line šŸ˜Ž

If you're curious to hear more about how we think privacy should be solved then we'd love if you took a look at our Pragmatic Privacy Manifesto, which you can read on our blog (uncaged.blog/manifesto/)

Collapse
 
thomasbnt profile image
Thomas Bnt ā˜• • Edited

Hello šŸ‘‹šŸ¼šŸ˜Š
Can be added to the help channel onDEV Connect?

Collapse
 
gameoverwill profile image
Wilfredo PĆ©rez • Edited

Hello guys, after I updated my sms-url from twilio-cli I got an error.

a483e79ff8f8:untitled wilfrelo$ twilio phone-numbers:update "+MY-NUMBER" --sms-url="http://localhost:1337/sms"
events.js:187
      throw er; // Unhandled 'error' event
      ^

Error: spawn ./ngrok ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19)
    at onErrorNT (internal/child_process.js:456:16)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:270:12)
    at onErrorNT (internal/child_process.js:456:16)
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawn ./ngrok',
  path: './ngrok',
  spawnargs: [ 'start', '--none', '--log=stdout' ]
}

Details here

IĀ“m stuck because I didnĀ“t have luck searching on Google. Please can someone help me?

Collapse
 
philnash profile image
Phil Nash

Are you able to download, install and run ngrok outside of the Twilio CLI? It looks like that is what is causing trouble here.

Collapse
 
gameoverwill profile image
Wilfredo PĆ©rez

Hey @phil I noticed during the weekend that my laptop that use in my job has blocked something that don't let me install or use ngrok. I tested my code in another computer and it's working.

Thanks for your help.

Thread Thread
 
philnash profile image
Phil Nash

That's good news! Glad you found out what happened and could test elsewhere.

Some comments may only be visible to logged-in visitors. Sign in to view all comments.