Command-Line Interface (CLI) Quickstart - Twilio

文章推薦指數: 80 %
投票人數:10人

Login to your Twilio account. In order for twilio-cli to access your Twilio account and execute commands on your behalf, you need to log in and provide your ... TwilioDocs SMS Voice Runtime Video Studio Alldocs... English English 日本語 Deutsch Français Português SDKs Help Login Signup SMS Voice Runtime Video Studio Alldocs... SDKs Help Login Signup TwilioCLI Menu Gettingstarted Quickstart Installorupdate Pastversions Docker Usetwilio-cli Generalusage Examples Plugins Uninstall ThisTwilioproductiscurrentlyavailableasaBetarelease.SomefeaturesarenotyetimplementedandothersmaybechangedbeforetheproductisdeclaredasGenerallyAvailable.BetaproductsarenotcoveredbyaTwilioSLA.Learnmoreaboutbetaproductsupport. twilio-cliallowsyoutomanageyourTwilioresourcesfromyourterminalorcommandprompt.Let’sgetitinstalledandtakeaquicktour. Installtwilio-cli macOS Windows Linux Docker npm InstallusingHomebrew Toinstalltwilio-clionmacOSusingHomebrew,run: brewtaptwilio/brew&&brewinstalltwilio InstallusingScoop Toinstalltwilio-clionWindowsusingScoop,runPowerShellasanadministratorand: Addthetwilio-cliBucket: scoopbucketaddtwilio-scoophttps://github.com/twilio/scoop-twilio-cli Installtheapp: scoopinstalltwilio Installusingapt Toinstalltwilio-cliondistributionssuchasDebian,Ubuntu,LinuxMint,andmoreusingAdvancedPackageTool(apt),runthefollowing: wget-qO-https://twilio-cli-prod.s3.amazonaws.com/twilio_pub.asc\ |sudoapt-keyadd- sudotouch/etc/apt/sources.list.d/twilio.list echo'debhttps://twilio-cli-prod.s3.amazonaws.com/apt//'\ |sudotee/etc/apt/sources.list.d/twilio.list sudoaptupdate sudoaptinstall-ytwilio RuntheDockerimage Torunthetwilio-cliasaDockerimagewithaninteractivebashshell,run: dockerrun-it--rmtwilio/twilio-clibash Consultthededicatedtwilio-cliDockerdocumentationformoredetailsonusage. Disclaimer It’sstronglyrecommendedtouseoneoftheotherinstallationmethodsifpossible.Aninstallationbynpmdoesnotauto-update,andusesyoursystem’sversionofNode.js,whichmaybeolderthantheversionTwiliodevelopstwilio-cliagainst. Installusingnpm Togloballyinstalltwilio-clisothatitcanbeusedfromanydirectory,use: npminstall-gtwilio-cli Refertothetwilio-cliinstallandupdatedocumentationformoreinstallationmethods. LogintoyourTwilioaccount Inorderfortwilio-clitoaccessyourTwilioaccountandexecutecommandsonyourbehalf,youneedtologinandprovideyourTwiliocredentials.Thiscanbedonebyrunning: twiliologin YouwillbepromptedforyourAccountSIDandAuthToken,bothofwhichyoucanfindonthedashboardofyourTwilioconsole. ThiswillcreateanAPIKeyforyouthatwillbestoredsecurelyandusedtoissueauthenticatedrequestsasyouusetwilio-cli.ThissecureAPIKeyandyoursettingswillbestoredlocallyasaprofile. Refertothegeneralusageguideifyouwouldliketousemultipleaccountsorprofileswithtwilio-clionthesamemachine. InstallCLIautocomplete(bashorzshonly) Autocompleteallowsyoutopartiallyenteraparameter,command,oroption,andeitherautomaticallycompletethecommandordisplaysuggestionsforyou.Ifyouhaveautocompleteenabled,youcanprompttwilio-cliforthesesuggestionsbypressingthecompletionkey(usuallyTabinmostshells). Enablecommandautocompletefortwilio-clibyrunningtheappropriatecommandforyourshell: bash zsh twilioautocompletebash twilioautocompletezsh Followtheresultinginstructions,andeitherrestartyourshelloropenanewonetofinishinstallingcommandautocomplete. Ifsuggestionsarenotappearing,double-checkthatyourestartedyourshelloropenedanewinstancesinceinstalling. Exploringtwilio-cli Thebestwaytolearnaboutwhatyoucandowithtwilio-cliistojustrunthecommand: twilio Whenyoudo,youwillgetalistofthevarioustopicsandcommandsavailabletorun.Topicsaregroupingsformoretopicsandcommands,similartothefolderstructureonyourfilesystem. $twilio UnleashthepowerofTwiliofromyourcommandprompt.Visithttps://twil.io/clifordocumentation. VERSION twilio-cli/3.0.0darwin-x64node-v16.13.1 USAGE $twilio[COMMAND] TOPICS apiadvancedaccesstoalloftheTwilioAPIs configmanageTwilioCLIconfigurations debuggerShowalistoflogeventsgeneratedfortheaccount emailsendsemailstosingleormultiplerecipientsusingTwilioSendGrid feedbackprovidefeedbacktotheCLIteam phone-numbersmanageTwiliophonenumbers pluginslistavailablepluginsforinstallation profilesmanagecredentialsforTwilioprofiles COMMANDS autocompletedisplayautocompleteinstallationinstructions feedbackprovidefeedbacktotheCLIteam helpdisplayhelpfortwilio logincreateanewprofiletostoreTwilioAccountcredentialsandconfiguration pluginslistinstalledplugins updateupdatethetwilioCLI Seesomethingthatlooksinteresting?Justtryrunningit: twilioapi Sinceapiisatopic,youwillactuallybeshownmoretopicsandcommandsthatarecontainedwithinthattopic.Let’ssayintheprocessofexploring,youstumbleduponthiscommand: twilioapi:core:messages:list Ifyourunthatcommand,itwilllistallofyourSMSmessages,whichmaybealot.Howcanyoufilterthem?Or,moregenerally,howcanyoudiscoverwhatoptionsagivenCLIcommandprovides?Theansweristoadd--helptothecommandlikeso: twilioapi:core:messages:list--help Ifyoutypeacommand,youmightgetanerrorifyouhaven’tprovidedalltherequiredoptions.Thisisanothersituationwhereadding--helptothecommandcangiveyoumoreinformation. Examples Listyourphonenumbers twiliophone-numbers:list Sendatextmessage twilioapi:core:messages:create\ --from"+15017122661"\ --to"+15558675310"\ --body"Iloveyou3000" Moreexamples Pleasevisitourexamplespageforagalleryofmoreexamples. What’snext? Nowthatyou’vebeenintroducedtotwilio-cli,whereshouldyougofromhere? Moreexamples Pleasevisitourexamplespageformoreexamplesofthevariousthingsyoucandowithtwilio-cli. Exploreplugins twilio-clicanbeextendedviaplugins.Youcanpublishyourownforthecommunity,ormakethemprivateforyourown(oryourclients')businessworkflows.TherearealreadyanumberofpluginsavailableforyoutoextendyourCLI. Generalusageguide RefertoourgeneralusageguidetoreadmoreaboutavarietyofCLIfeatures: Storecredentialsinenvironmentvariables Webhookstolocalhost Differentoutputformats Loggingmessagelevel Multipleaccounts/profiles Useyourcompany'sTLScertificateforAPIrequests Splitatwilio-clicommandintomultiplelines Sendusfeedback Finally,we’dlovetohearfromyou.Anytimeyouhavefeedbackyou’dliketosendus,justrun: twiliofeedback Ratethispage: Needsomehelp? Wealldosometimes;codeishard.Gethelpnowfromoursupportteam,orleanonthewisdomofthecrowdbyvisitingTwilio'sStackOverflowCollectiveorbrowsingtheTwiliotagonStackOverflow. Ratethispage: OnThisPage Thankyouforyourfeedback! Pleaseselectthereason(s)foryourfeedback.Theadditionalinformationyouprovidehelpsusimproveourdocumentation: IfapplicablefillinthecountrieswhereyouareusingTwilio Missinginformationorcode Contentisconfusingorhardtofollow Inaccurateoroutdatedinformation Brokenlinkortypo Didnotsolvemyproblem Contentiseasytofollow Solvedmyproblem Other Sendyoursuggestions Needhelp?TalktoSupport ProtectedbyreCAPTCHA–Privacy-Terms Sendingyourfeedback... 🎉Thankyouforyourfeedback! Somethingwentwrong.Pleasetryagain. Thanksforyourfeedback! Referusandget$10in3simplesteps! Step1 Getlink Getafreepersonalreferrallinkhere Step2 Give$10 Yourusersignsupandupgradeusinglink Step3 Get$10 1,250freeSMSesOR1,000freevoiceminsOR12,000chatsORmore Learnmoreaboutthereferralprogram



請為這篇文章評分?