Skip to content

Use Twilio SMS and Voice APIs to interact with Algorand PureStake Blockchain API

License

Notifications You must be signed in to change notification settings

rashansmith/algorand-purestake-twilio-sms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Summary

This sample SpringBoot Java project uses the Twilio SMS and Voice APIs to allow users to interact with the Algorand Blockchain Purestake API. Through text and phone calls you are able to:

  • get the supply on MainNet/TestNet/BetaNet through SMS and Voice
  • get the last round on MainNet/TestNet/BetaNet through SMS and Voice

This sample implementation can be expanded to many more features and interactions.

Prerequisites:

Get Started:

git clone https://github.com/rashansmith/algorand-purestake-twilio-sms
cd algorand-purestake-twilio-sms
mvn clean install

Twilio Configuration Instructions:

If you want more detailed instructions: https://www.twilio.com/blog/2013/10/test-your-webhooks-locally-with-ngrok.html

Expose your localhost:8080 port with ngrok (windows command). The exposed url will be used in the Twilio Developer Console:

ngrok http 8080 

ngrokImage

Configure your Twilio Messaging webhook to use exposed ngrok address:

In the Twilio Dev Console, Go to Manage Numbers -> Active Numbers and click on the number you are going to use for this project

Scroll down to the Voice & Fax section

  • Add your ngrok url
  • Add '/voice' at the end of your url (this the endpoint defined in our controller)
  • Set the WebHook to GET
  • Click save

vcTwilio

Scroll down to the Messaging section

  • Add your ngrok url
  • Add '/text' at the end of your url (this the endpoint defined in our controller)
  • Set the WebHook to GET
  • Click save

twilioImage

Deploy the application with your credentials:

Modify the src/main/resources/application.properties file:

# Twilio API Keys and relevant variables
spring.twilioAccountSid= # Add your AccountSID here 
spring.twilioAuthToken=  # Add your AuthToken here 
spring.twilioNumber=	# Add your twilioNumber here 
spring.myNumber=         # Add your Number here (optional)

#PureStake API keys and relevant variables
spring.algodApiAddress.url= # Add your PureStake API Address here
spring.algodApiKey= # Add your PureStake API Key here

From the project directory in the command terminal:

mvn spring-boot:run

Test application

Text 'supply' to your Twilio number:

supplyScreenshot

Text 'lastround' to your Twilio number:

lastRoundScreenShot

Call your Twilio number:

  • Press any number (to bypass trial introduction statment)
  • Follow the voice command (Press 1 for the supply, press 2 for the lastround)
  • a voice will provide the result and hangup.

About

Use Twilio SMS and Voice APIs to interact with Algorand PureStake Blockchain API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages