Send Text Notification from your Synology NAS with Free Mobile (SMS)
Tags: tutorial, api, synology, beginners
Published: 2024-04-29 14:00:00

> **This article is for you if** you own a Synology NAS and your Mobile provider is [Free Mobile](https://mobile.free.fr/).

## Free Mobile API

Free Mobiles provides an API endpoint to send text messages <u>to yourself</u> when you have a phone subscription. The feature has been available since June 2014. However, it is not documented officially. 

You must make a GET request to the following the API endpoint:
```
GET https://smsapi.free-mobile.fr/sendmsg?user=$user&pass=$pass&to=$to&msg=$message
```
Details of each query parameter:
* **$user**: Your Free login
* **$pass**: Your API key
* **$to**: Your phone number
* **$message**: The message URL encoded.

The API returns the following code responses:

| Status Code | Meaning |
|---|---|
| **200** | The text message (SMS) has been sent to your mobile phone. |
| **400**  | One of the query parameter is missing. |
| **402** | Too many text message has been sent in a short period. |
| **403** | The service is not activated on your Free account, or the login is incorrect, or the password is not valid. |
| **500** | Server error, try the request again later. |

To get your API key, log in to your [Free Account](https://mobile.free.fr/account/), then click on the "My Option" link on the left. Then activate the option **Notifications par SMS**, your API key will appear:

![Free Mobile interface to get the API key](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o7836ae47unmypdv8ei9.png)

## Synology Text Notifications

Log in to your Synology NAS, then open the "Control Panel" > "Notifications" > "Webhooks".

![Synology Notification interface to manage webhooks](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6dgf3iekq4xaqokxecuz.png)

In the middle of the screen, click on "Add", you will get the following view. For the `provider` option, select "Custom", and for the `rule`, it's up to you: it defines which notifications are send, you may select "critical".

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hl49yc5dd297a3jrh3li.png)

Then, the popup displays a form with configurations:
* For the `Provider Name`, write "Free Mobile".
* For the `Subject`, write any subject your want.
* For the `Webhook URL`, write the Free API endpoint and replace the `$user`, `$pass` and `$to` with their corresponding values. 
```js
https://smsapi.free-mobile.fr/sendmsg?user=$user&pass=$pass&to=$to&msg=%40%40TEXT%40%40
```

![Popup configuration to setup the API URL](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6k409njkpgafdpvqkln2.png)

The last step asks the HTTP method to make sure the **GET** is selected: 

![Last notification configuration](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0w3eviseh357slgcjt3r.png)

Finally, click on the **Apply** button to save the new Text message notification. A new webhook element will appear on the Synology notification interface:

![List of webhooks on the synology interface](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7in7gy8u0jsnnref3jkh.png)

To verify whether it works, click the "Send Text Message" button, and you must receive the following message on your phone:

![Text message received from a Synology NAS on Iphone](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oed46smb0ddiv8nv6xcf.jpg)

Voilà, now you will receive notification from your Synology NAS through Text Messages, Cheers! 🍻