GithubHelp home page GithubHelp logo

powershell-sms's Introduction

PowerShell-SMS

Send SMS messages using SMS APIs with PowerShell.

This module currently supports the following SMS API providers:

How do I install this module?

You can manually instaal this module by yourself by cloning this repository if you want to, but for your convenience I have made this automatic installation script:

If ([Environment]::OSVersion.Platform -eq "Unix") {
    $ModulePath = [Environment]::GetEnvironmentVariable("PSModulePath").split(":")[0]
    If (Test-Path "$ModulePath/PowerShell-SMS.zip"){Remove-Item "$ModulePath/PowerShell-SMS.zip"}
    If (Test-Path "$ModulePath/PowerShell-SMS"){Remove-Item "$ModulePath/PowerShell-SMS" -Confirm:$false -Recurse -Force}
    Invoke-WebRequest https://github.com/bmsimons/PowerShell-SMS/zipball/master -OutFile "$ModulePath/PowerShell-SMS.zip"
    Expand-Archive "$ModulePath/PowerShell-SMS.zip" -DestinationPath "$ModulePath"
    Remove-Item "$ModulePath/PowerShell-SMS.zip"
    Get-ChildItem "$ModulePath" | where { $_.Name -like "bmsimons-PowerShell-SMS*" } | % { Move-Item -Path ("$ModulePath/"+$_.Name) -Destination "$ModulePath/PowerShell-SMS" }
} Else {
    $ModulePath = [Environment]::GetEnvironmentVariable("PSModulePath").split(";")[0]
    If (Test-Path "$ModulePath\PowerShell-SMS.zip"){Remove-Item "$ModulePath\PowerShell-SMS.zip"}
    If (Test-Path "$ModulePath\PowerShell-SMS"){Remove-Item "$ModulePath\PowerShell-SMS" -Confirm:$false -Recurse -Force}
    Invoke-WebRequest https://github.com/bmsimons/PowerShell-SMS/zipball/master -OutFile "$ModulePath\PowerShell-SMS.zip"
    Expand-Archive "$ModulePath\PowerShell-SMS.zip" -DestinationPath "$ModulePath"
    Remove-Item "$ModulePath/PowerShell-SMS.zip"
    Get-ChildItem "$ModulePath" | where { $_.Name -like "bmsimons-PowerShell-SMS*" } | % { Move-Item -Path ("$ModulePath\"+$_.Name) -Destination "$ModulePath\PowerShell-SMS" }
}

Just copy-paste the above code in your PowerShell interpreter and you should be good to go! (Please note that the automatic installer is only confirmed to work in the open-source version of PowerShell)


Configure PowerShell-SMS for use with Twilio

Import-Module PowerShell-SMS

Set-Twilio -AccountSid YOURACCOUNTSIDGOESHERE -AuthToken YOURAUTHTOKENGOESHERE

Configure PowerShell-SMS for use with Nexmo

Import-Module PowerShell-SMS

Set-Nexmo -APIKey YOURAPIKEYGOESHERE -APISecret YOURAPISECRETGOESHERE

Configure PowerShell-SMS for use with SMSAPI

Import-Module PowerShell-SMS

Set-SMSAPI -Bearer YOURBEARERGOESHERE

Send an SMS with Twilio

Send-SMS -To +3161234123412 -From +3161234123411 -Message "Hello, Twilio!" -Provider Twilio

Send an SMS with Nexmo

Send-SMS -To +3161234123412 -From +3161234123411 -Message "Hello, Nexmo!" -Provider Nexmo

Send an SMS with Twilio

Send-SMS -To +3161234123412 -From +3161234123411 -Message "Hello, SMSAPI!" -Provider SMSAPI

PowerShell-SMS in action:

Nexmo Send SMS Nexmo Receive SMS

powershell-sms's People

Contributors

bmsimons avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

powershell-sms's Issues

How to use SMSAPI

How to use this module with smsapi?

What is "-Bearer YOURBEARERGOESHERE"

is API? or password in MD5?

im trying this (XXXXIx3ZUfjCEov66SkIfhgcQCLVwXLcSIGpXXXX is my API key genereted in panel)

Set-SMSAPI -Bearer XXXXIx3ZUfjCEov66SkIfhgcQCLVwXLcSIGpXXXX
Send-SMS -To +48533XXXXXX -From 'scribe.pl' -Message "Hello, SMSAPI!" -Provider SMSAPI

error message             
----- -------             
  101 Authorization failed

Get balance powershell

Hi!

Love the script! Been using it for 2 weeks now. Just love it! Keep up the good work.
We do have a question, is it possible to get the remaining balance after a SMS has been send? We are using Nexmo.

With kind regards,
Kopertje

Error: New-Object : Cannot find an overload for "PSCredential" and the argument count: "2".

When I sent a SMS I get the following error:
New-Object : Cannot find an overload for "PSCredential" and the argument count: "2".
At C:\Users\USER\Documents\WindowsPowerShell\Modules\PowerShell-SMS\Actions\Send-SMS.ps1:43 char:148

  • ... Credential (New-Object System.Management.Automation.PSCredential($Twi ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [New-Object], MethodException
    • FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand

Maybe something simple but the PowerShell is new for me.
I have executed:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
Import-Module PowerShell-SMS
Set-Twilio -AccountSid ACfc.............c9 -AuthToken 934b...........5d
Send-SMS -To +316.........32 -From +141.............48 -Message "Hello, Pieter!" -Provider Twilio

Running on Win10
$PSVersionTable
Name Value


PSVersion 5.1.19041.610
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.19041.610
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.