Send Text Message Free Mobile PowerShell

Send Text Message Free Mobile PowerShell

Hello,

In France, we have a mobile phone provider named “Free Mobile”. They expose an API for each subscriber to allow us to send text message to our-selves.This feature is free of charge so you can use it quite a lot without any down side. This can be useful many cases:

  • Alert when a script end
  • Alert when a script fail
  • Alert on an event (attach task to this event)
  • Alert on condition inside a script (e.g. drive failure)
  • etc…

The API is exposed here:

https://smsapi.free-mobile.fr/sendmsg

You need 3 parameters to use it:

  1. UserID
  2. Password
  3. Text

The first one is your UserID composed of 8 digits, the password associated with it is a special one (different from the one of your account) that can be found on your personal information in your Free Mobile account. The last one is the text you want to send in the text.

Hereunder an example:

$User = '12345678'
$Pass = '1234567890'
$Text = 'This is a test from PowerShell !' -replace ' ','%20'
$FreeUrl = "https://smsapi.free-mobile.fr/sendmsg?user=$User&pass=$Pass&msg=$Text"
Invoke-WebRequest -Uri $FreeUrl

Note: You need to replace each space (‘ ‘) in your sentence with ‘%20’ for encoding purpose.

Send Text Message Free Mobile PowerShell - PowerShell Example

Send Text Message Free Mobile PowerShell – PowerShell Example

And now, let’s have a look at my phone:

Send Text Message Free Mobile PowerShell - Text

Send Text Message Free Mobile PowerShell – Text

The text is here!

Leave a Reply