Scenarios

To build something worthwhile we need a "real" customer and a set of "real" scenarios.

A telecommunications company called C-Mobile provides various services to its customers. They identified a need to assist their pay-as-you-go customers with various services around topping up their accounts and buying data packages.

 

Scenario #1 — check my balance

As a customer, I want to be able to ask my Alexa device to check my balance.

Alexa should respond with the amount of credit I have left on my account together with the remaining minutes, texts and data.

 

Scenario #2 — top-up

As a customer, I want to be able to top up my account.

Alexa should guide me through the required steps, provide with a list of options, and at the end provide the updated credit on the account.

 

Scenario #3 — buy a data package

As a customer, I want to be able to buy additional data packages.

Alexa should guide me through the required steps, provide me with a list of data packages, which should be paid for with the credits on the account.

 

Assumptions / simplification of the scenario

Usually, when you build applications for services like this, you will have a functionality that allows your user to log in to their specific account. In the case of voice assistants, this usually is handled through the admin portal, which then automatically associates the user account with their app.

This is a whole topic on its own, which I am planning to cover in another blog post. Instead, I will ask you to hardcode the user id in the project.

API

C-Mobiles provides you with a very simple API, which allows you to manage individual accounts.

You can access all of the calls from the following https://demoapis.com/cmobile/:

Please note that all API calls expect an id parameter. Please pick one number 9-11 digits long, and use it for all of your calls. This way when you top up an account and then ask for the account status, you will see the balance updated.

Also, if you happen to use a number that someone else is also using (this is not very likely unless you use the demo id), just pick a different number and you should be fine.

Here is the list of available functions:

getAccountStatus

getAccountStatus allows you to ask for the Account balance, minutes, SMS, and data.

Signature:

You need to provide your selected account id.

Example:

Here is an example of how to get the account balance for id 012345678

https://demoapis.com/cmobile/getAccountStatus/012345678

Result:

 

topUp

topUp allows you to top up your account balance, as a result, the balance will increase and you will receive an updated account status.

Signature:

You need to provide your selected account id.

Additionally, you need to provide two query params:

Example:

Here is an example of how to top the account id 012345678 with 10 credits using the card ending with 9876 (don't worry no card payment will actually happen 😉).

https://demoapis.com/cmobile/topUp/012345678?val=10&card=9876

Result:

 

availableCards/:id

availableCads allows you to look up all associated payment cards with the account.

Signature:

You need to provide your selected account id.

Example:

Here is an example of how to check what payment cards are associated with the account id 012345678.

https://demoapis.com/cmobile/availableCards/012345678

Result:

 

resetAccount

resetAccount allows you to reset your account. This can come useful when you want to start from scratch.

Signature:

You need to provide your selected account id.

Example:

Here is an example of how to reset the account id 012345678.

https://demoapis.com/cmobile/resetAccount/012345678

Result:

 

showDataPackages

showDataPackages allows you to view available data packages for you to purchase.

For each package you will receive a name, amount of data in GB and MB, and a price.

Signature:

No parameters are required.

Example:

Here is an example of how to view available data packages.

https://demoapis.com/cmobile/showDataPackages

Result:

 

buyData

buyData allows you to purchase more data for your account. As a result, more data will be added to the account, and the price of the package will be deducted from the balance.

Signature:

You need to provide your selected account id.

Additionally, you need to provide a query param dataPack with the name of the package that you want to purchase.

Example:

Here is an example of how to buy a medium data pack for the account id 012345678.

https://demoapis.com/cmobile/buyData/012345678?dataPack=medium

Result: