IdeaMart Simple SMS Application in Java

/
14 Comments

IdeaMart

Ideamart is a platform presented by Dialog Axiata PLC to developers and content providers to use the Dialog network based features via shared APIs and monetize their efforts.

Hope you have an idea about what ideamart is. ideamart is a vast popular platform these days. I have seen lot of television advertisements also. But in the mean time I was unable to find any web application (website) which have  used ideamart APIs. So this tutorial will guide you how to use ideamart APIs in a web application. I am using basic java, JSP, servlet for this tutorial. You can extend it to any other framework like spring, vaadin, etc. This tutorial will guide you to implement following scenarios.
  • Receiving a message
  • Sending a message
  • Displaying received messages in a html page     
Prerequisites 
  • java 1.8
  • ideamart simulator 
  • apache tomcat 8
  • apache maven 3
  • IDE  (I am using intellij idea) 
Hope you are familiar with the above stuff. First you need to download or clone the repository. 
after downloading it you can open your favorite IDE and import the pom.xml file. It will download all the dependencies. To run the program you have to configure apache tomcat to your IDE 

How to configure apache tomcat in IntelliJ IDEA

Implementation 

Below image is displaying the source code structure after all the above configurations.
     
receive - This package is to handle the receiving messages. To receive a message and to send a message you need a library given by the ideamart. It is included in the resources directory. By implementing the MoSmsListener class you can handle the receiving messages. I hope you can easily understand it when you look at the Receive class implementation. receiving message URL is configured in the web.xml file. 

operations - when you receive a message you can do any operation for that. In this tutorial I am splitting it and put it into a hashmap. You can do any other operation you need.    

send - This package is to send messages to particular number. SmsRequestSender class can be used for that. 

db - This package is used for database operations. For this implementation i am using a hashmap. You can use any other database like sql or nosql. 

I hope you got some idea about the implementation. Now you are free to run the application. Before you run the program please make sure that all the libraries are included into the artifacts.
For that If you use intellij idea press Shift+ CTRL + ALT + S and then you can see the project structure.
It looks like below.
In the above picture both selected library and the other one are not in the artifacts. To add those into it right click on it and select "put into WEB-INF/lib" 
Then you can start the server and the ideamart simulator. 
You can see the index page and ideamart simulator like below.

                                                                                                             

URL - http://localhost:8080/Receiver
This URL is configured in the web.xml. In this tutorial I am going to get the name and the message with application name as a message. So your message format should have above three details.
ex - <app name> tharinda mymessage

Now you can send this message and wait for the response. When the response message came reload the index page and you will get the result below.
That's it! Hope this will help you. 

Thanks for reading :)

If you have any problem, feel free to leave a comment and I appreciate any feedback. 

For more info and contact me go to my website.



You may also like

14 comments :

  1. My app doesn't need to receive sms from the customers, instead it only needs to send sms to the customers' mobile phones. So that, how can i modify the code to perform my task without implementing the MoSmsListener interface?

    ReplyDelete
  2. You can't send messages to customers using their mobile number. Dialog will give you a hash code for each mobile number. Only it can be used for send messages to customer through ideaMart. it's not possible to send messages to customers without getting at least one message from him/her.

    ReplyDelete
  3. i'm using netneans and and mysql. please how can i do run correctly this project? please

    ReplyDelete
  4. i'm using netbeans and and mysql. please how can i do to run correctly this project? please

    ReplyDelete
    Replies
    1. You don't need mysql to run this project. And also the project is independent from IDE. So you can use any IDE you like. Simply this is a web application and Tomcat is used as a container. Maven is used as a building tool. You can use below link[1] to learn how to run tomcat project in Netbeans.
      [1] - https://netbeans.org/kb/docs/web/quickstart-webapps.html

      Delete
  5. how to do it with netbeans
    plz can you help me

    ReplyDelete
    Replies
    1. The project is independent from IDE. So you can use any IDE you like. Simply this is a web application and Tomcat is used as a container. Maven is used as a building tool. You can use below link[1] to learn how to run tomcat project in Netbeans.
      [1] - https://netbeans.org/kb/docs/web/quickstart-webapps.html

      Delete
  6. I am expecting more interesting topics from you. And this was nice content and definitely it will be useful for many people.
    Digital Mobile Marketing
    SMS API
    SMS Marketing

    ReplyDelete
  7. Nice post it is very useful for all. An SMS API Java application gateways are the important and powerful tool when we talk about communication through text messages.

    ReplyDelete

Powered by Blogger.