The Sms Menu

Integration with Twilio

Playbasis platform can integrate with a Twilio account to be able to send sms. All users doing a specific valuable action (buy a product, etc…) can be for example rewarded and allowed to redeem and get a coupon by sms. The small tutorial below shows how to do.

Create a rule

Configure interface with Twilio

Create Goods

Import list of Goods

Set points to deduct when Redeem

API usage

Send http requests to Playbasis API following these steps below in order a user can redeem and get a sms coupon.

Step 1
Register a User. Fill up the mobile number : +6681234567

Step 2
When a User do a valuable action (buy a product, etc…), send the corresponding action to API. The received action will trigger the matched Rule and the User will get the points associated to this Rule / action. For example : 100 points.

Step 3
Send Redeem request to API for a User.
The system will deduct the number of points to redeem this good (100 points for example) from the User account. The user will receive a sms coupon with the good to redeem. The system remove one good from the list of available goods.
If the user has not enough points, cannot redeem this good.
If the good is not available in the system, cannot redeem this good (no points deducted).

Step 4
When a group of goods quantity is empty or almost empty, upload a new file of same group of goods to increase the quantity of goods in the Dashboard.

Example :
Content-Type: application/x-www-form-urlencoded

Get the token in return :

Register a user :

Content-Type: application/x-www-form-urlencoded
token=0cc9eb0bd6c57186xxxxxxxc3721b9039db7&username=player1& Just in case, Update User without phone number :

Content-Type: application/x-www-form-urlencoded

Send an action to engine :

Content-Type: application/x-www-form-urlencoded

Get user information :

Get the availability of a good in a group of good : GET player Redeem a good in a group of good :

Content-Type: application/x-www-form-urlencoded

Get in return
8830644924 => redeem code or use variable {{ code }}
54253396be4321404d2664b9 => ref_id of the redeem transaction done by the user

Send SMS coupon :

Content-Type: application/x-www-form-urlencoded
token=0cc9eb0bd6c57186xxxxxxxc3721b9039db7&ref_id=54253396be4321404d2664b9&player_id=player1&message=Congratulation, here is your coupon code: {{code}}.

For the moment, only 1 Variables you can use : {{code}} which display the code of the coupon to redeem.
We will have more variables available in future version.

Any special char used in the sms message (like ', ", ...) must be url encoded.

All the HTTP requests above can be sent using the Playbasis API Explorer

Example to redeem a good in a group of goods: