Customer state v Session state


Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Customer state v Session state

  1. 1. CustomerState vs. SessionStateCustomerState is information associated with an individual mobile user. It should be used to storepermanent information associated with a mobile user, such as their name, their home address, andother bits of information that is unique to a user and relevant to your eTXT application.SessionState is information that is temporary, and lasts for approximately 60 minutes since the lasttime a user responded to a message from your application. It should be used to track temporaryinformation that is only relevant for a particular “conversation” between the application and amobile user. Examples include the current page in an SMS “wizard”, as well as informationpreviously collected as part of that dialogue.SessionState explainedHave you ever left your web-browser open on a secure page for a while not doing anything.....Thenyou go back to it and click a link and it says "Sorry, your session has timed out please login again"?A session in the eTXT API works in the same way. When 60 minutes have passed since the user lastinteracted with an application, the system ends their session. When this expires, any temporaryinformation – such as where you were on a web page, the contents of your shopping cart, and othertemporary information, is gone.Session information will be passed in the sessionstate member of the request object passed to yourapplication.CustomerState explainedCustomerState is like the information that exists after you have logged into a web site. This“permanent” information would include things like your name, your mailing address, and your creditcard details…something that should remain the same across multiple computers and browser“sessions.”CustomerState information in the eTXT API is information that will always be sent to the callbackURL irrespective of which session is currently active. It will be passed in the customerstate memberof the request object passed to your application.
  2. 2. Example JSON Code 1This example demonstrates setting the customer state. Customer state, once set, will cross sessionboundaries, and be sent each time until changed. This demonstrates a theoretical restaurant servicewhich finds restaurants near to a particular street location. It is triggered by sending #restaurant to30000 Request 1 …HTTP Headers… { "customerstate":null, "id":"09883dc9-a90c-4bb6-b71f-73e94a56e618", "msg":"#restaurant", "sessionstate":null } Response 1 …HTTP Headers… { "customerstate":null, "id":"09883dc9-a90c-4bb6-b71f-73e94a56e618", "msg":"Hello, what is your name?", "sessionstate":null } Request 2 (continuation of session) …HTTP Headers… { "customerstate":null, "id":"09883dc9-a90c-4bb6-b71f-73e94a56e618", "msg":"John", "sessionstate":null } Response 2 …HTTP Headers… { "customerstate":”John”, "id":"09883dc9-a90c-4bb6-b71f-73e94a56e618", "msg":"Hello John, Reply with your street address", "sessionstate":null }
  3. 3. Example JSON Code (new session)This shows use of session state, which is a temporary store of information that lasts for around 60seconds. It also shows the persistence of customer state, which is passed again to the applicationURL because it was set in a previous session. As before, it is triggered by sending #restaurant to30000 Request 1 (new session) …HTTP Headers… { "customerstate":”John”, "id":"09883dc9-a90c-4bb6-b71f-73e94a56e618", "msg":"#restaurant", "sessionstate":null } Response 1 …HTTP Headers… { "customerstate":”John”, "id":"09883dc9-a90c-4bb6-b71f-73e94a56e618", "msg":"Hello John, what is street address?", "sessionstate":null } Request 2 (enter street address) …HTTP Headers… { "customerstate":”John”, "id":"09883dc9-a90c-4bb6-b71f-73e94a56e618", "msg":"7172 Hawthorn Ave", "sessionstate":null } Response 2 …HTTP Headers… { "customerstate":”John”, "id":"09883dc9-a90c-4bb6-b71f-73e94a56e618", "msg":"What is your city?", "sessionstate":”7172 Hawthorn Ave” }
  4. 4. Request 3 (enter city)…HTTP Headers…{ "customerstate":”John”, "id":"09883dc9-a90c-4bb6-b71f-73e94a56e618", "msg":"Los Angeles", "sessionstate":”7172 Hawthorn Ave”}Response 3…HTTP Headers…{ "customerstate":”John”, "id":"09883dc9-a90c-4bb6-b71f-73e94a56e618", "msg":"Here are the restaurants near 7172 Hawthorn Ave: …", "sessionstate":”7172 Hawthorn Ave|Los Angeles”}