Académique Documents
Professionnel Documents
Culture Documents
Api SMS Orange
Api SMS Orange
1.1
Getting started (/apis/sms/getting-started)
Version française
1. Souscription à une API
2. Achat de bundles
3. Envoi de SMS
3.1 Envoi de SMS avec un sender name par defaut
3.2 Envoi de SMS avec un sender name personnalisé
3.3 Envoi de SMS on-net
4. A propos des accusés de réception
5. Administration de votre compte
5.1 Votre solde de SMS
5.2 Bilan d'usage des SMS
5.3 Historique des achats
Notez que vous pouvez contacter à tout moment les équipes locales d'Orange depuis
ce formulaire (https://developer.orange.com/sms-api-queries/) pour demander
Une fois que vous avez souscrit à l'API à partir de votre application sur ce portail, pour
utiliser l'API, vous devrez vous authentifier à l'aide d'un token OAuth 2.0 v3. Le token a
une durée de validité d'une heure, aussi veuillez noter que votre application doit mettre
en œuvre un mécanisme permettant de le renouveler automatiquement à chaque fois
qu'il expire.
Les credentials (ID client, secret client) permettant de générer le token et d'utiliser
l'API se trouvent dans la section "MyApps" de ce site Web, comme le montre la
capture d'écran ci-dessous.
curl -X POST \
-H "Authorization: {{authorization_header}}" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json" \
-d "grant_type=client_credentials" \
https://api.orange.com/oauth/v3/token
Vous recevez alors des données au format JSON, dont vous pouvez extraire votre
{{access_token}} :
HTTP/1.1 200 OK
Content-Type: application/json
{
"token_type": "Bearer",
"access_token": "{{access_token}}",
"expires_in": "3600"
}
Dans ce cas, il vous suffit de redemander un nouveau token. Pour plus d'information
sur les erreurs potentielles, merci de consulter le guide
(https://developer.orange.com/tech_guide/2-legged-oauth-2-v3/) complet.
2. Achat de bundles
Afin de faciliter la découverte des APIs SMS et leur intégration dans votre service,
Orange vous propose l'achat d'un Starter bundle ou pack de démarrage à très bas
prix, directement depuis votre abonnement mobile. Veuillez noter que ce pack ne peut
être acheté qu'une seule fois par compte Orange Developer et numéro de téléphone
mobile de développeur.
3. Envoi de SMS
En supposant que vous avez déclaré votre application, que vous avez souscrit à la ou
les API SMS souhaitées et que vous avez acheté votre bundle, vous pouvez
maintenant commencer à envoyer des SMS à vos clients. Voici les informations
techniques dont vous aurez besoin :
Note : Vous devez avoir un contrat avec une date d'expiration valide et un
solde positif. Si votre contrat a expiré ou si vous n'avez plus d'unités, vous
devez acheter un nouveau bundle comme décrit ci-dessus, sinon vous recevrez
un message d'erreur.
Le TPS est limité à 5 SMS par seconde.
Il existe deux façons d'envoyer des SMS : soit avec le sender name par défaut, soit
avec un sender name personnalisé.
Par exemple, si vous avez demandé l'ajout du sender name "MonService" et que cela
été validé par l'équipe locale Orange, pour envoyer des SMS avec le sender name
"MonService", vous devrez faire un appel comme suit :
curl -X POST -H "Authorization: Bearer {{access_token}}" \
-H "Content-Type: application/json" \
-d '{"outboundSMSMessageRequest":{ \
"address": "tel:+{{recipient_phone_number}}", \
"senderAddress":"tel:+{{country_sender_number}}", \
"senderName": "MonService", \
"outboundSMSTextMessage":{ \
"message": "Hello!" \
} \
} \
}' \
"https://api.orange.com/smsmessaging/v1/outbound/tel%3A%2B{{country_send
er_number}}/requests"
{
"outboundSMSMessageRequest":{
"senderAddress":"tel:+{{recipient_phone_number}}",
"senderName": "MonService",
"outboundSMSTextMessage":{
"message":"Hello!"
},
"resourceURL":"https://api.orange.com/smsmessaging/v1/outbound/t
el:+{{recipient_phone_number}}/requests/{{resource_id}}"
}
}
Vous obtenez en retour un {{resource_id}} comme unique identifiant (ID) que vous
devez enregistrer si vous souhaitez par la suite le corréler avec d'autres informations,
dont l'accusé de réception Delivery Receipt (DR). {{resource_id}} est une chaîne de
caractères avec le format typique suivant : xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx .
Exemple de réponse :
HTTP/1.1 200 OK
Value Description
DeliveryUncertain Status inconnu, par ex. car acheminé par un autre réseau que
celui d'Orange
curl -X GET \
-H "Authorization: Bearer {{access_token}}" \
"https://api.orange.com/sms/admin/v1/contracts"
Cette requête retourne les données de votre solde SMS et la date d'expiration au
format JSON :
[
{
"id": "6368bdba70585131d5454a5a",
"type": "SELFSERVICE", // or BROKER
"developerId": "{{developerId}}",
"applicationId": "{{applicationId}}",
"country": "CIV",
"offerName": "SMS_OCB",
"availableUnits": 120,
"requestedUnits": 0,
"status": "ACTIVE", // or EXPIRED
"expirationDate": "2023-01-07T15:04:20.653Z",
"creationDate": "2022-11-07T08:11:38.220Z",
"lastUpdateDate": "2022-12-08T15:04:20.656Z"
}
]
Note : la réponse est un tableau avec un élément par pays. Ce tableau peut
contenir plusieurs éléments si vous avez souscrit avec le même compte aux
APIs SMS de plusieurs pays. Vous pouvez ajouter un paramètre optionnel pour
filtrer la réponse par pays, avec /sms/admin/v1/contracts?
country={{country_code}} où {{country_code}} est le code standard
international à 3 digits - par ex. CIV pour la Côte d'Ivoire. Tous les codes "ISO
3166 alpha 3" sont listés ici (http://en.wikipedia.org/wiki/ISO_3166-1_alpha-3?
api=sms_ci_product#Officially_assigned_code_elements).
5.2 Bilan d'usage des SMS
Depuis votre application ou votre espace d'administration, vous pouvez consulter le
nombre de SMS envoyés par application et par pays. Pour cela, il vous suffit de
réutiliser votre {{access_token}} en appelant le end-point:
/sms/admin/v1/statistics , comme ci-dessous :
curl -X GET \
-H "Authorization: Bearer {{access_token}}" \
"https://api.orange.com/sms/admin/v1/statistics"
Cette requête retourne votre consommation de SMS par application (et par pays) au
format JSON :
{
"partnerStatistics": {
"developerId": "{{developerId}}",
"statistics": [
{
"service": "SMS_OCB",
"serviceStatistics": [
{
"country": "CIV",
"countryStatistics": [
{
"appid": "yf1qyS4gv****",
"usage": 2,
"nbEnforcements": 2
}
]
}
]
}
]
}
}
Vous pouvez ajouter 2 paramètres optionnels pour filtrer par pays et application :
/sms/admin/v1/statistics?country={{country_code}}&appid={{app_id}}
curl -X GET \
-H "Authorization: Bearer {{access_token}}" \
"https://api.orange.com/sms/admin/v1/purchaseorders"
Cette requête retourne votre historique d'achat de packs SMS par application (et par
pays) au format JSON. Exemple :
[
{
"id": "6368bdba70585131d5454a5b",
"developerId": "{{developerId}}",
"contractId": "63***",
"country": "CIV",
"offerName": "SMS_OCB",
"bundleId": "6368b9b35455a62e00d9997a",
"bundleDescription": "Bundle 0 - 20 SMS for 320 FCFA (Starter fo
r 7 days)",
"price": 320.00,
"currency": "XOF",
"purchaseDate": "2022-11-07T08:11:38.260Z",
"paymentMode": "OTP_SMS_OCB",
"paymentProviderOrderId": null,
"payerId": "22507******",
"type": "BUNDLE_PURCHASE",
"oldAvailableUnits": 0,
"newAvailableUnits": 20,
"oldExpirationDate": "2022-11-07T22:59:59.000Z",
"newExpirationDate": "2022-11-14T08:11:38.227Z"
},
{
"id": "6391fcf45b1130****",
"developerId": "{{developerId}}",
"contractId": "63*****",
"country": "CIV",
"offerName": "SMS_OCB",
"bundleId": "6368b9b35455a62e00d9997d",
"bundleDescription": "Bundle 1 - 100 SMS for 1 600 FCFA (for 30
days)",
"price": 1600.00,
"currency": "XOF",
"purchaseDate": "2022-12-08T15:04:20.664Z",
"paymentMode": "NOCHALLENGE_OM",
"paymentProviderOrderId": "374213*****",
"payerId": "{{developerEmail}}",
"type": "BUNDLE_PURCHASE",
"oldAvailableUnits": 20,
"newAvailableUnits": 120,
"oldExpirationDate": "2022-12-13T23:59:59.000Z",
"newExpirationDate": "2023-01-07T15:04:20.653Z"
},
]
Vous pouvez filtrer la réponse par pays en utilisant un paramètre optionnel :
/sms/admin/v1/purchaseorders?country={{country_code}} où {{country_code}} est
le code standard international à 3 digits - par ex. CIV pour la Côte d'Ivoire. Tous les
codes "ISO 3166 alpha 3" sont listés ici (http://en.wikipedia.org/wiki/ISO_3166-
1_alpha-3?api=sms_ci_product#Officially_assigned_code_elements).
========================================
English version
With Orange SMS APIs and a few lines of code, you can easily send SMS, be
notified on delivery receipts and manage your account as admin.
Table of contents
1. Subscribe to the API
2. Buy a bundle
3. Send SMS to your customers
3.1 Send an SMS with the default senderName
3.2 Send an SMS with a custom senderName
3.3 Send on-net SMS
4. About SMS Delivery Receipt
5. Administer your account
5.1 View your SMS balance
5.2 View your purchase history
5.3 SMS usage statistics
Once you have subscribed to the API from your application on this portal, in order to
use the API you will need to authenticate using an OAuth 2.0 v3 token; the token will
only be available for one hour, so please be aware that your application should
implement a mechanism to automatically renew it each time the token expires.
The credentials (Client ID, Client secret) to generate the token and use the API can
be found in the “MyApps” section of this website as shown in the screenshot below.
curl -X POST \
-H "Authorization: {{authorization_header}}" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json" \
-d "grant_type=client_credentials" \
https://api.orange.com/oauth/v3/token
HTTP/1.1 200 OK
Content-Type: application/json
{
"token_type": "Bearer",
"access_token": "{{access_token}}",
"expires_in": "3600"
}
Full documentation on how to generate such a token can be found on this page 2-
Legged OAuth2.0 Proxy V3 (https://developer.orange.com/tech_guide/2-legged-
oauth-flow-step-by-step/).
Note: please do not generate a token for each call; reuse the same token for 60
minutes for all requests you need to make to this API. To do this, you should
handle the out-of-date error type and generate a new token each time such
an error occurs.
2. Buy a bundle
Before you can send an SMS, you'll need to buy a bundle. Orange wants to make your
integration easier, so we have created a starter bundle with some SMS at a very good
price. Please note that this starter bundle can only be bought once per Orange
Developer account or per Orange phone number you will be using for payment.
Example
3. Send SMS to your customers
Assuming you've declared your application with the relevant SMS API(s) and
purchased your bundle, you can now start sending SMS to your customers.
Here's the technical information you'll need:
Note: You must have a contract with a valid expiry date and a positive balance.
If your contract has expired or you have no units left, you should purchase a
new bundle as described above, otherwise you will receive an error message.
TPS is limited to 5 SMS per second.
There are two ways to send SMS: either with the default sender name or with a
custom sender name.
You can use a slightly different call, by adding the senderName parameter in the body,
to send SMS from a specific sender name that was previously associated with your
account.
In both cases, the request will return Headers and JSON data with information about
the SMS if it was sent successfully or an HTTP error with more information about the
error in the JSON data. In case of success, in the response body you'll get a
{{resource_id}}; you should save it if you want to correlate it with a Delivery Receipt
(DR) later on; {{resource_id}} is a string with the following typical format: xxxxxxx-
xxxx-xxxx-xxxx-xxxxxxxxxxxx.
• must be **whitelisted ** on the Orange SMS API server before being used; to do this,
please fill in this web form (https://developer.orange.com/sms-api-queries/) which
will be sent to the technical team
Example:
SMS DR request from Orange to your SMS backend and DR notification endpoint
POST https://{{dev_host}}:443/orange/smsdr.php HTTP/1.1
Content-Type: application/json
{
"deliveryInfoNotification":{
"callbackData":"{{resource_id}}",
"deliveryInfo":{
"address":"tel:+{{recipient_phone_number}}",
"deliveryStatus":"{{delivery_status}}"
}
}
}
Example: Response by the partner
HTTP/1.1 200 OK
In the JSON body of the Orange request, your backend server receives 3 important
pieces of information:
• {{resource_id}}: the unique ID of your previously well sent SMS that you will need to
use to correlate the corresponding SMS
Value Description
Example
curl -X GET \
-H "Authorization: Bearer {{access_token}}" \
"https://api.orange.com/sms/admin/v1/contracts"
This query returns your SMS units balance and their expiration date, in JSON format :
[
{
"id": "6368bdba70585131d5454a5a",
"type": "SELFSERVICE", // or BROKER
"developerId": "{{developerId}}",
"applicationId": "{{applicationId}}",
"country": "CIV",
"offerName": "SMS_OCB",
"availableUnits": 120,
"requestedUnits": 0,
"status": "ACTIVE", // or EXPIRED
"expirationDate": "2023-01-07T15:04:20.653Z",
"creationDate": "2022-11-07T08:11:38.220Z",
"lastUpdateDate": "2022-12-08T15:04:20.656Z"
}
]
Note: the response is an array with one element per country if you have
subscribed to APIs in different countries using the same account. You can add
the country as a parameter if you want to filter:
https://api.orange.com/sms/admin/v1/contracts?country={{country_code}}
where {{country_code}} is the ISO3 country code.
curl -X GET \
-H "Authorization: Bearer {{access_token}}" \
"https://api.orange.com/sms/admin/v1/purchaseorders"
This query returns the purchase history for the current account by country, in JSON
format.
Example :
[
{
"id": "6368bdba70585131d5454a5b",
"developerId": "{{developerId}}",
"contractId": "63***",
"country": "CIV",
"offerName": "SMS_OCB",
"bundleId": "6368b9b35455a62e00d9997a",
"bundleDescription": "Bundle 0 - 20 SMS for 320 FCFA (Starter fo
r 7 days)",
"price": 320.00,
"currency": "XOF",
"purchaseDate": "2022-11-07T08:11:38.260Z",
"paymentMode": "OTP_SMS_OCB",
"paymentProviderOrderId": null,
"payerId": "22507******",
"type": "BUNDLE_PURCHASE",
"oldAvailableUnits": 0,
"newAvailableUnits": 20,
"oldExpirationDate": "2022-11-07T22:59:59.000Z",
"newExpirationDate": "2022-11-14T08:11:38.227Z"
},
{
"id": "6391fcf45b1130****",
"developerId": "{{developerId}}",
"contractId": "63*****",
"country": "CIV",
"offerName": "SMS_OCB",
"bundleId": "6368b9b35455a62e00d9997d",
"bundleDescription": "Bundle 1 - 100 SMS for 1 600 FCFA (for 30
days)",
"price": 1600.00,
"currency": "XOF",
"purchaseDate": "2022-12-08T15:04:20.664Z",
"paymentMode": "NOCHALLENGE_OM",
"paymentProviderOrderId": "374213*****",
"payerId": "{{developerEmail}}",
"type": "BUNDLE_PURCHASE",
"oldAvailableUnits": 20,
"newAvailableUnits": 120,
"oldExpirationDate": "2022-12-13T23:59:59.000Z",
"newExpirationDate": "2023-01-07T15:04:20.653Z"
},
]
You can add the country as a parameter if you want to filter:
https://api.orange.com/sms/admin/v1/purchaseorders?country={{country_code}}
where {{country_code}} is the the ISO3 country code.
Example :
curl -X GET \
-H "Authorization: Bearer {{access_token}}" \
"https://api.orange.com/sms/admin/v1/statistics"
{
"partnerStatistics": {
"developerId": "{{developerId}}",
"statistics": [
{
"service": "SMS_OCB",
"serviceStatistics": [
{
"country": "CIV",
"countryStatistics": [
{
"appid": "yf1qyS4gv****",
"usage": 2,
"nbEnforcements": 2
}
]
}
]
}
]
}
}
You can filter on the result by using one of the following optional parameters
{{country_code}} and/or {{app_id}}
/sms/admin/v1/statistics?country={{country_code}}&appid={{app_id}}
• {{country_code}} is the ISO3 country code
Find us on
(https://twitter.com/OrangeDev)
(https://www.linkedin.com/groups/2842716)
(https://www.youtube.com/channel/UC-H3yaXICSD461bn75c_X5A)
(https://github.com/Orange-OpenSource)
(https://www.programmableweb.com/company/orange)
APIs
(https://developer.orange.com/products/)
Orange Money Web payment (https://developer.orange.com/apis/om-webpay/)
SMS Africa and Middle East (https://developer.orange.com/apis/sms/)
Pay with Orange Bill (https://developer.orange.com/apis/pay-with-orange-bill/)
Operator Eligibility (https://developer.orange.com/apis/operator-eligibility-fr)
Discover 118 712 (https://developer.orange.com/apis/discover-118712/?
utm_source=developer.orange&utm_medium=referral&utm_campaign=weekselection)
All APIs (https://developer.orange.com/products/all-apis/)
Resources
(https://developer.orange.com/resources/technical-guides/)
How to start guide (https://developer.orange.com/resources/quickstart/)
Technical guides (https://developer.orange.com/resources/technical-guides/)
Blog (/blog)
Customer stories (https://developer.orange.com/customer-stories/)
Glossary (https://developer.orange.com/tech_guide/all-about-apis-glossary/)
Contact
(https://developer.orange.com/resources/contact-us/)
About us (https://developer.orange.com/about-us/)
Contact us (https://developer.orange.com/resources/contact-us/)
Contact the SMS local team (https://developer.orange.com/sms-api-queries/)