Solution SMS

Bannière Découvrez Dialog, une exclusivité Primotexto qui va révolutionner votre communication par SMS !

API SMS

Intégrez Primotexto à vos applications grâce à notre puissante API SMS.

  >  
  >  


SMS de notification

A voir aussi : SMS marketing



Envoyer un SMS de notification

LES MESSAGES A CARACTERE MARKETING SONT STRICTEMENT INTERDITS ICI !

Requête à envoyer

URL

https://api.primotexto.com/v2/notification/messages/send

HTTP METHOD

POST

HEADERS

X-Primotexto-ApiKey: YOUR_API_KEY Content-Type: application/json

DATA

{ "number": "+33600000000", "message": "Code de confirmation: 283951", "sender": "YourCompany", "campaignName": "Code de confirmation", "category": "codeConfirmation", "date": 1398177000000 }

Retour de l'API


HEADERS

HTTP/1.1 200 OK Date: Fri, 08 Jan 2016 15:11:02 GMT Server: Apache Content-Type: application/json;charset=UTF-8 Vary: Accept-Encoding Transfer-Encoding: chunked

DATA

{ "creditsUsed":1.0, "snapshotId": "386479" }
Objets DATA
Description
! Paramètres REQUIS !
"number"
Le destinataire du message: "+33600000000"
Format: 0600000000, +33600000000
"message"
Le contenu du message: "Code de confirmation: 283951"
Caractéres autorisés: abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@£_!$"#èé%ù&ìò()*:+;,<-=ÑñÅ.>Üüåé/?à|^¤{}~\'
Options
"sender"
L'expediteur personnalisé du message: "YourCompany".
Sans personnalisation, l'expediteur sera un short code numérique de type XX XXX.
Si vous personnalisez l'expediteur, celui-ci doit comporter entre 3 et 11 caractères ALPHANUMERIQUES.
"campaignName"
Le nom de votre pool de messages: "Code de confirmation"
Ce paramètre sert à regrouper plusieurs envois dans un même pool,
pour obtenir des statistiques globales sur ces envois.
"category"
Le Tag de votre pool de messages: "codeConfirmation"
Ce Tag est la clé de recherche pour vos envois.
A utiliser dans vos différentes requêtes: stats, blacklists, callbacks...
"date"
"date": 1398177000000 => Tue, 22 Apr 2014 14:30:00 GMT
Programmation de la campagne pour une date définie (format: timestamp millisecondes).

// Génerez votre clé API: https://www.primotexto.com/api/compte/authentification.asp
// Remplacez les paramètres (urlencode) et collez l'URL dans votre navigateur

https://api.primotexto.com/v2/notification/messages/send?&apiKey=YOUR_API_KEY&identifier=YOUR_NUMBER&sender=YOUR_SENDER&message=YOUR_MESSAGE
// Download library -> https://www.primotexto.com/api/librairies/latest-php.asp require_once 'primotexto-api-php/baseManager.class.php'; // Authentication authenticationManager::setApiKey('YOUR_API_KEY'); // New notification SMS $sms = new Sms; $sms->type = 'notification'; $sms->number = '+33600000000'; $sms->message = 'Code de confirmation: 283951'; $sms->sender = 'YourCompany'; $sms->campaignName = 'Code de confirmation'; $sms->category = 'codeConfirmation'; $sms->date = 1398177000000; messagesManager::messagesSend($sms);
curl -X POST \ -H "X-Primotexto-ApiKey: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"number":"+33600000000","message":"Code de confirmation: 283951","sender":"YourCompany","campaignName":"Code de confirmation","category":"codeConfirmation","date": 1398177000000}' \ https://api.primotexto.com/v2/notification/messages/send
// Download library -> JDK 1.5 : https://www.primotexto.com/api/downloads/java/primotexto-api-3.2-jdk-1.5.zip // Download library -> JDK 1.6 : https://www.primotexto.com/api/downloads/java/primotexto-api-3.2-jdk-1.6.zip // Download library -> JDK 1.7 : https://www.primotexto.com/api/downloads/java/primotexto-api-3.2-jdk-1.7.zip import com.primotexto.*; // Authentication AuthenticationManager.setApiKey("YOUR_API_KEY"); // Send SMS Notification PTMessage msg = new PTMessage(); msg.setType("notification"); msg.setNumber("+33600000000"); msg.setMessage("Code de confirmation: 283951"); msg.setSender("YourCompany"); msg.setCategory("codeConfirmation"); msg.setCampaignName("Code de confirmation"); msg.setDate(1398177000000); PTMessageResponse response = MessagesManager.messagesSend(msg); System.out.println(response.toString());
// Download library -> https://www.primotexto.com/api/downloads/latest-net.asp using Primotexto; // Authentication AuthenticationManager.setApiKey("YOUR_API_KEY"); // Send SMS Notification PTMessage msg = new PTMessage(); msg.setType("notification"); msg.setNumber("+33600000000"); msg.setMessage("Code de confirmation: 283951"); msg.setSender("YourCompany"); msg.setCategory("codeConfirmation"); msg.setCampaignName("Code de confirmation"); msg.setDate(1398177000000); MessagesManager.messagesSend(msg);
#!/usr/bin/env ruby require 'json' require 'rest-client' apiKey = 'YOUR_API_KEY' url = 'https://api.primotexto.com/v2/notification/messages/send' sms= <<-JSON_SMS { "identifier": "+33600000000", "message": "Code de confirmation: 283951", "campaignName":"Code de confirmation", "tag":"codeConfirmation", "sender":"YourCompany", "date": 1398177000000 } JSON_SMS response = RestClient.post(url, sms, { 'Content-Type' => 'application/json', 'X-Primotexto-ApiKey' => apiKey } ) puts response
// Installation -> npm install node-rest-client var apiKey = "YOUR_API_KEY"; var url = "https://api.primotexto.com/v2/notification/messages/send"; var sms = { "identifier": "+33600000000", "message": "Code de confirmation: 283951", "sender": "YourCompany", "campaignName": "Code de confirmation", "tag": "codeConfirmation", "date": 1398177000000 }; var Client = require('node-rest-client').Client; var client = new Client(); client.post(url, { data: sms, headers: { "X-Primotexto-ApiKey": apiKey, "Content-Type": "application/json" } }, function (data, response) { console.log(data); });
#!/usr/bin/env python import requests apiKey = 'YOUR_API_KEY' url = 'https://api.primotexto.com/v2/notification/messages/send' data = '{"number": "+33600000000", "message": "Code de confirmation: 283951", "sender": "YourCompany", "campaignName": "Code de confirmation", "category": "codeConfirmation", "date": 1398177000000 }' response = requests.post(url, headers={'X-Primotexto-ApiKey': apiKey, 'Content-Type':'application/json'}, data=data) print response.content
#!/usr/bin/perl use REST::Client; my $apiKey = 'YOUR_API_KEY'; my $url = 'https://api.primotexto.com/v2/notification/messages/send'; my $data = '{"number": "+33600000000", "message": "Code de confirmation: 283951", "sender": "YourCompany", "campaignName": "Code de confirmation", "category": "codeConfirmation", "date": 1398177000000 }'; my $client = REST::Client->new(); $client->POST($url, $data, { "X-Primotexto-ApiKey" => $apiKey, "Content-type" => 'application/json'}); print $client->responseContent()."\n";
myApiKey est une chaîne = "YOUR_API_KEY" myUrl est une chaîne = "https://api.primotexto.com/v2/notification/messages/send" mySms est une chaîne ANSI = [ { "message": "Code de confirmation: 283951", "number": "+33600000000", "sender": "YourCompany", "campaignName": "Code de confirmation", "category": "codeConfirmation", "date": 1398177000000 } ] cMaRequete est un restRequête cMaRequete..Contenu = mySms cMaRequete..URL = myUrl cMaRequete..Méthode = "POST" cMaRequete.Entête["X-Primotexto-ApiKey"] = myApiKey cMaRequete..ContentType = "application/json" cMaReponse est un restRéponse = RESTEnvoie(cMaRequete) SI ErreurDétectée ALORS Erreur(ErreurInfo(errComplet)) SINON Info(cMaReponse..Contenu) FIN