To be able to use CRM, you will need to generate API keys that uniquely identify your application in the system.
To generate the API keys for your application, here is the procedure to follow:
Activer service
if this is your first access.
Create SMS account
, if you don't have one yet.
Access the service
.
Generate API keys
.
There are three (3) API keys:
Once the keys are generated, you can now use our CRM.
JSON
.
To consume the endpoints of our CRM, you always need an authorization token.
https://crm.paydunya.com/api/v1/auth/login
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/vnd.apisms.v1+json" \
-F "user_key: USER-KEY" \
-F "secret_key: SECRET-KEY" \
"https://crm.paydunya.com/api/v1/auth/login"
Do not forget to replace them with their values.
{
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9zbXMucGF5ZHVueWEuY29yZVwvYXBpXC92MVwvYXV0aFwvbG9naW4iLCJpYXQiOjE1NTI2NTEwNzYsImV4cCI6MTU1MjY1NDk3NiwibmJmIjoxNTUyNjUxMDc2LCJqdGkiOiJWMjBKNk1SUFh0eldMS3VOIiwic3ViIjoyLCJwcnYiOiI4N2UwYWYxZWY5ZmQxNTgxMmZkZWM5NzE1M2ExNGUwYjA0NzU0NmFhIn0.xagI2zndC6ThraHFrZC9qNS_BdnmNlbN2tOHU2PKinY",
"token_type": "bearer",
"expires_in": 3600,
}
https://crm.paydunya.com/api/v1/sms/send
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/vnd.apisms.v1+json" \
-H "Authorization: Bearer TOKEN" \
-d '{
"send_sms_request":{
"type": "application",
"app_key": "APP-KEY",
"sms": [
{
"from": "SENDER-ID",
"to":"+221776665544",
"text": "Un sms de test."
}
]
}
}' \
"https://crm.paydunya.com/api/v1/sms/send"
SENDER-ID is the signature of the SMS. Taking as value the name of the SMS account, it corresponds to the sending name of the SMS, it is the sender name which will be displayed at destination. Remember to put the correct signature which is configured at the account level, otherwise the default name SMS-TEST will be taken into account.
Do not forget to replace them with their values.
For this endpoint, you have noticed that the sms node takes an array of objects (SMS: from, to, text). Note that we support up to 50 sms (objects) per request
.
{
"code": "00",
"message": "sms_sent",
"description": "The sms sent successfully",
"data": {
"sms": [
{
"code": "CODE-SMS",
"sender_addresss": "SENDER-ID",
"receiver_address": "+221776665544",
"text": "Un sms de test."
},
]
}
}
Beyond the endpoints to have a token and send an sms, there is also another which will allow you to recover the stats. This method returns a list of sent sms. This list can be personalized according to the recipients(receivers_address
) and the period(start_date and end_date
) which will be specified in the request.
https://crm.paydunya.com/api/v1/sms/stats
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/vnd.apisms.v1+json" \
-H "Authorization: Bearer TOKEN" \
-d '{
"sms_sent":
{
"type": "application",
"app_key": "APP-KEY",
"filters":
{
"receiver_address": [
{
"value": "+221776665544"
},
{
"value": "+221773332211"
},
{
"value": "+22173214354"
}
],
"start_date": "2018-01-01 00:00:00",
"end_date": ""
}
}
}' \
"https://crm.paydunya.com/api/v1/sms/stats"
Knots start_date
, end_date
are optional. They are two values that allow us to define a period. You can set empty strings as values if you don't want to use them.
"code": "00",
"message": "success",
"description": "The request is success",
"data": {
"invalid_number": [
{
"value": "22173214354"
}
],
"valid_number": [
{
"221773332211": []
},
{
"221776665544": [
{
"code": "CODE-SMS",
"content": "Un sms de test."
}
]
}
]
}
}
The knot invalid_number
can disappear from one request to another. It will only appear if there is at least one invalid number. Regarding the knot valid_number
, lSMS will be associated with their recipients. In this sense, the numbers to which you have never sent SMS will have an empty table.
Code | Message | Description |
---|---|---|
00 | sms_sent | The sms sent successfully |
success | The request is process successfully | |
ERROR_101 | sms_not_sent_success | The sms is not send successfully |
ERROR_102 | inufficient_balance | Insufficient balance |
ERROR_103 | balance_not_updated | Balance not updated |
ERROR_104 | invalid_content_request | The body of this request is not valid |
ERROR_105 | invalid_data_content_request | The body of this request is not valid |
ERROR_106 | invalid_type | The type is not valid |
ERROR_107 | invalid_key | The key is not valid |
ERROR_108 | invalid_sender_address | The sender address is not valid |
ERROR_109 | empty_address | No address found |
ERROR_110 | invalid_receiver_address | The receiver address is not valid |
ERROR_111 | number_recipients_not_authorize | The number of receiver address is not authorize (Between 1 and 50 accepted) |
ERROR_112 | invalid_content_message | The content message is not valid |
ERROR_113 | content_sms_too_long | The content message is too long |
ERROR_114 | invalid_start_date | The start date is not valid |
ERROR_115 | invalid_ende_date | The end date is not valid |
ERROR_116 | error_server | Error process on the server |
ERROR_117 | invalid_credentials | The credentials are invalid |
ERROR_118 | credentials_not_found | The credentials are not found |
ERROR_119 | could_not_create_token | The token is not create |
ERROR_120 | user_not_found | The user is not found |
ERROR_121 | token_expired | The token is expired |
ERROR_122 | token_invalid | The token is invalid |
ERROR_123 | token_not_found | The authorization token is not found |
ERROR_124 | logout_token | The authorization token is logout |