To send subscription messages you need to make 2 api calls: 

  • one to retrieve the checkout token, 
  • the other to send the createSubscription() request that contains the generated token.

The checkoutToken is a string that can be obtained by making a call to this endpoint:
on live -> https://api.africastalking.com/checkout/token/create on sandbox - https://api.sandbox.africastalking.com/checkout/token/create

The endpoint only requires a phoneNumber as a POST parameter, it will return a JSON object that looks like this when successful

{
"description":"Success",
"token":"CkTkn_5fccf6fa-172f-4566-9d42-fd441d236b44"
}

and like this when it fails

{"description":"Too many requests in the current window",
"token":"None"
}

This token is among the parameters required for the createSubscription() function as well as the keyword and Shortcode that are mapped to your account.
You then send all these parameters to the SMS subscription endpoint -> https://api.africastalking.com/version1/subscription/create that you are expected to supply when initiating a subscription request.

The tokens expire after 10 minutes and are limited to 2 tokens for a 5 minute window for each source IP Address.

I hope this clarifies things but for further questions email info@africastalking.com

Did this answer your question?