Documentation

Services

Examples > Autoreply, A simple 2-way scenario


This example demonstrates how to implement a simple 2-way scenario, A customer service scenario where you recieve customer questions via SMS and you reply with a confirmation SMS.
e.g. Your recieved a "What is today interest rate" message from 012345678912.
your reply would be "Thank you for contacting our customer service, your request will be processed ASAP"

We will assume your SMS provider sends your messages over HTTP, and you are assigned short code 9999

  1. Receiving:

    We need to create a new HTTP server:

    Note: You should replace the HTTP parameters with the ones your SMS provider uses

  2. Sending

    We will assume you will also send your messages over HTTP, this means we need to create a new HTTP client:

    Note: You should replace the HTTP parameters with the ones your SMS provider uses

  3. Scenario

    This simple scenario will have only one action, A sender action to reply to the customer with a fixed message

    Notice that we used the gateway created in (2) to send the messages
    from = ${TO} means we will send the reply from the number we received the message on. int his case 9999
    to = ${FROM} means we will send the reply to the number we received the message from, in this case 012345678912

  4. Test

    Start the server your created in (1):
     

    Test using a browser to generate a request like the one you will typically receive:

    Notice that the http parameters used here are the ones configured in (1).


    You can also check the request log under the debug folder

    [2007-11-24 12:35:51.640] [] [SERVICE=MySMSprovider]  
    [2007-11-24 12:35:51.640] [] [ARG2=today]  
    [2007-11-24 12:35:51.640] [] [ARG0=What]  
    [2007-11-24 12:35:51.640] [] [TO=9999]  
    [2007-11-24 12:35:51.640] [] [ARG3=interest]  
    [2007-11-24 12:35:51.656] [] [TEXTNOKW= is today interest rate]  
    [2007-11-24 12:35:51.656] [] [ARG1=is]  
    [2007-11-24 12:35:51.656] [] [ARG4=rate]  
    [2007-11-24 12:35:51.656] [] [KEYWORD=What]  
    [2007-11-24 12:35:51.656] [] [TEXT=What is today interest rate]  
    [2007-11-24 12:35:51.656] [] [FROM=012345678912]  
    [2007-11-24 12:35:51.718] [] Request created in 16 ms 
    [2007-11-24 12:35:51.718] [] [to=9999]  
    [2007-11-24 12:35:51.718] [] [text=What is today interest rate]  
    [2007-11-24 12:35:51.734] [] [from=012345678912]  
    [2007-11-24 12:35:51.765] [Start] Invoked 
    [2007-11-24 12:35:51.765] [reply] Invoked 
    [2007-11-24 12:35:52.250] [reply] [...]  
    [2007-11-24 12:35:52.250] [reply] Finished in 485, executed:true, error: false 
    [2007-11-24 12:35:52.250] [Start] Finished in 485, executed:true, error: false 
    [2007-11-24 12:35:52.250] [] Finished in 594