![]() If I press tab, it will automatically create. So see how I can do messages and I can do tab, and it will show me what I can do now. And now if I do, I might need to do a new window still, api:core:me. ![]() I'm going to run and get the autocomplete setup in my zsh shell. And see that I'm running zsh, so I need to run this here, this command. So that's the SMS, but by just adding the media URL, we automatically converted to use the MMS. You'll note that the MM here at the start of this SID that comes back, this MM, the one before that we sent, had an SM on it. So exciting! And you'll see that by simply adding that image, we sent an MMS. ![]() Media-url, and I'm going to paste the GIF there. And at the end here, what I'm going to do is I'm going to use media-url. The URL of a media, the media can be of type GIF, PNG, or JPEG. So we could, wow, there's a bunch of stuff. So if we were going to pass a help command here, and what will happen is we'll see notes about what we can do. And at the end of this, I'm also going to pass a -help. Now, one of my favorite things about the CLI is if I, I'm going to press up arrow, and I'm going to get my message back. And remember, it worked because we sent it to my number, which I verified when we set up the account. That of course, if we upgrade, will go away, but this still works for what we're trying to do. Any message that's sent out to a verified number during trial will have that. So that's the prefix that we're talking about. And you'll notice it says, "Sent from your Twilio trial account -," and then what we did, "Ahoy, World". And it's going to have, as you'll see here in a second, it's going to have a little message on the front of it. Remember, that's the one of the limitations here. Now, the reason why we can text to my phone number is 'cause I validated that when I set it up. And then I'm going to put in my phone number 'cause we want to text it. And now instead of, "Hi there," we want this to say, "Ahoy, world." That's the "Hello, world" of Twilio apps, "Ahoy, world." All right, so we did that. So it's there on the console, and I'll paste that. I'm going to go ahead and copy this 'cause we only have one. And the phone number is actually on the console as well at this point. And instead of from, we're going to put our phone number there. And you'll see that we have stuff set up here. I'm going to copy that and I'm going to paste it into my terminal. So if we flip back over to the docs, and we come in here, you'll see, again, we're at SMS API reference message resource in the Twilio CLI here for create a message. So now that we've got the account set up and authenticated to our client, we can send a text message. Otherwise, it would say false if it wasn't. You'd have multiple ones here, and you'll see that it's active and it says true. And I can just make sure that it's active. So maybe you have different projects and things like that. And then I'm going to do a shorthand for my, so I can remember it later 'cause you could have multiple accounts, as you'll see. So we're going to paste the password here, Auth Token. All right, so I'm going to paste this here. That's like giving you the keys to my car, or actually, that's like leaving the cars on the front seat of your car. I can show it if I wanted to, but I don't want to. I'm going to flip back and I am going to paste. ![]() ![]() So I'm going to copy that, this little copy button here. I head over there and you'll see here I have this Account SID. And it's going to ask for our Account SID, again, that's like our username. So we're going to do Twilio profiles:add. So the first thing that we need to do is we need to set up it to map to our account. How'd it go? So I got it installed, and I can tell because if I type Twilio, at my command line, we'll now see that it comes back and it says, "Unleash the power of Twilio from your command prompt." Let's do that. And after you've got it installed, unpause me. So why don't you go ahead and pause me, and get the CLI installed in your computer, whatever operating system you have. So I'm going to use the instructions on this macOS and the instructions are at twil.io/cli. If you click between, if you're on Windows, you do the Windows. So the installation instructions are a little different for Mac and Windows, and I'm on a Mac at the moment, but there are instructions here. Let's get the Twilio CLI installed and configured, and then send a text message from the comfort of your command line. If you aren't sure what a command line is, make sure you check the notes and we'll get you all sorted out. Good news is that Twilio has a pretty awesome CLI that is wonderful for learning. In my opinion, the best way to explore any API is by using a CLI, or a command line interface. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |