How to send an SMS from the LWS API

Procédure

What is an API and why use one?

API stands for "Application Programming Interface". It is a set of means used by a software application and/or platform to provide access to some of its functionality.

Nowadays, APIs are widely used on the internet, particularly by service or data providers, such as the SMS service.

Thanks to APIs, you can use your own script to send an SMS instantly or at a later time.

How to send an SMS using the LWS API

Send an SMS using a simple call:

To send an SMS quickly and easily, simply send an HTTPS request with its parameters to the following address:

https://sms.lws.fr/sms/api?action=send-sms&api_key=SMS_API_KEY=&to=DESTINATAIRE&from=SenderID&sms=VOTRE_MESSAGE

The data to be replaced is as follows:

  • SMS_API_KEY: This is your API key, which you can access in the "SMS API" section of your SMS space.
  • RECIPIENT: This is the recipient's telephone number in international format
  • SenderID: This is your sender identifier
  • YOUR_MESSAGE: content of the SMS

Using the PHP API:

You can send an SMS using a PHP API:

<?php /* Prepare the variables */ /* API Url */ $gateway_url = "https://sms.lws.fr/sms/api"; /* Action called via the API */ $action = "send-sms"; /* API key */ $apiKey = "Your API key"; /* Number to which the SMS will be sent * International format - example 33600000000 */ $to = "33600000000"; /* SenderID that will be displayed on the mobile phone. */ $senderID = "Your SenderID"; /* Encodes the SMS version of the message that will be sent */ $message = urlencode("This is a test message"); // Prepare the array of data for the API request $data = array('action' => $action, 'api_key' => $apiKey, 'to' => $to, 'from' => $senderID, 'sms' => $message, ); // Send the API request via cURL $ch = curl_init($gateway_url); curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); $get_data = json_decode($response, true); /* The return is processed.
 * get_data['code'] retrieves a code according to the success or error of the API * get_data['Message'] retrieves the message Success or explanation of the error.
 */ if($get_data['code'] === 'ok'){ echo 'The SMS was sent successfully'; } else { echo 'Error code : '.$get_data['code'].' -- '.$get_data['message']; } ?>
  • Your API key: This must be the API key you generated on the SMS platform.
  • The recipient's telephone number: This is the number of the recipient of the SMS message.
  • Your Sender Name: This is your SenderID, which can be created on the SMS platform
  • Your message: The message you are going to send by SMS

Possible error codes :

100: Problem with the operator;
103 : Invalid telephone number;
105 : Use of a prohibited word;
106 : SenderID invalid or not validated;
107 : SMS typing problem;
112: Number blacklisted or API not available;

How to send a deferred SMS from the LWS API

Send an SMS using a simple call:

https://sms.lws.fr/sms/api?action=send-sms&api_key=SMS_API_KEY=&to=DESTINATAIRE&from=SenderID&sms=VOTRE_MESSAGE&schedule=DATE_HEURE
  • SMS_API_KEY: Must be replaced by your API key
  • DESTINATORY: Must be replaced by the recipient number of the message
  • SenderID: must be replaced by your sender name
  • YOUR_MESSAGE: must be replaced by your message
  • DATE_TIME: Must be replaced by the date and time of sending. You can convert the date and time by visiting the Timestamp site.

Presentation of the LWS API functions linked to the SMS platform


Conclusion

You can now create your own API using the LWS SMS platform. You can use an API to send an SMS instantly or at a later time. The API will also allow you to see how much credit is left on your account.

Don't hesitate to share your comments and questions!

Rate this article :

5/5 | 1 opinion

This article was useful to you ?

Article utileYes

Article non utileNo

Vous souhaitez nous laisser un commentaire concernant cet article ?

Si cela concerne une erreur dans la documentation ou un manque d'informations, n'hésitez pas à nous en faire part depuis le formulaire.

Pour toute question non liée à cette documentation ou problème technique sur l'un de vos services, contactez le support commercial ou le support technique

MerciMerci ! N'hésitez pas à poser des questions sur nos documentations si vous souhaitez plus d'informations et nous aider à les améliorer.


Vous avez noté 0 étoile(s)

Similar articles


Questions sur l'article
Delor98& Il y a 778 days
Bonjour Mr excuses moi svp mon site web a été suspendu pour problèmes de non renouvelé je comprend rien de tout ça aussi je ne c'est par comment faire renouvelé en fin d'être connecté a nouveau
See the
1 answers
fabrice-LWS - Il y a 774 days
Bonjour, vous avez la possibilité de renouveler un domaine ou une formule d'hébergement si ces derniers sont toujours disponibles sur votre espace client. Vous pouvez, dans ce cas, renouveler en suivant la procédure suivante : https://aide.lws.fr/a/860
Utile ?
SOBETAM.COM Il y a 661 days
Bonjour Pouvez vous intervenir pour mon site SOBETAM.COM elle bloqué pour des raison d'heubergement dans autre localité hors depuis que j'ai rachaté le nom de domain , j'ai pas été confronté a une tel situation . fais quelque chose j'ai renouveler
See the
1 answers
fabrice-LWS - Il y a 659 days
Bonjour, après vérification, votre domaine est actuellement suspendu par le registre. Je vous invite à vous rendre sur votre espace client LWS, cliquez sur "Votre identifiant" puis sur "Editer coordonnées". Je vous invite à vérifier vos informations et à cliquer sur le bouton" Sauvegarder" se trouvant en bas de page. Vous devriez recevoir dans les deux heures suivantes, un e-mail en anglais avec un lien permettant de valider vos informations et débloquer votre domaine. Je vous invite également à vérifier que l'e-mail n'ait pas atterri dans le dossier Spam de votre boîte e-mail.
Utile ?
LWSClient Il y a 485 days
Il n est fait mention nulle part des parametres pour gerer les reponses SMS avec une URL de traitement
See the
1 answers
Benjamin-LWS - Il y a 480 days

Bonjour,

Merci de votre retour.

Actuellement notre plateforme SMS, ne permet seulement d'envoyer des messages, les réponses à vos SMS ne seront pas récupérer et donc vous ne pourrez pas les traiter. C'est un système omnidirectionnel.

Je vous remercie de votre attention et reste à votre disposition pour toute autre question ou complément d'information.

Nous vous invitons à contacter notre service support à travers votre espace client, afin de vous apporter une aide si vous rencontrez des difficultés quelconque. (Contacter le support LWS)

Cordialement, L'équipe LWS 

Utile ?

Ask the LWS team and its community a question