Skip to content

Commit de1dfef

Browse files
davkutalekishuah
authored andcommitted
Update to latest action types and fields (#3)
* Add action types and STK to docs Added info about action types for USSD push and variable longstring. Added more info about STK and especially the expected text field for STK number choices * Add Press OK step to quickstart * Update ussd.md Replace depreciated extra * Replace depreciated extra * Add input_extras to session result fields * update extras fields in result
1 parent 3d6cd18 commit de1dfef

File tree

5 files changed

+52
-12
lines changed

5 files changed

+52
-12
lines changed

_includes/action_result.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<pre><code class="java" data-lang="java">@Override
33
protected void onActivityResult (int requestCode, int resultCode, Intent data) {
44
if (requestCode == 0 &amp;&amp; resultCode == Activity.RESULT_OK) {
5-
String[] sessionTextArr = data.getStringArrayExtra("ussd_messages");
5+
String[] sessionTextArr = data.getStringArrayExtra("session_messages");
66
String uuid = data.getStringExtra("uuid");
77
} else if (requestCode == 0 &amp;&amp; resultCode == Activity.RESULT_CANCELED) {
88
Toast.makeText(this, "Error: " + data.getStringExtra("error"), Toast.LENGTH_LONG).show();

actions.md

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,48 @@ Actions can be updated anytime from within your Hover dashboard so that you do n
1212
###### Actions consist of
1313

1414
- **Name** of your choice, for example "Send Money".
15-
- **Mobile networks**/SIM cards that can run the USSD service.
16-
- **Root code**, the shortcode used to dial the USSD service.
17-
- The USSD menu **steps**. See below.
15+
- **Description** optional, for your internal use on the dashboard. Anything to help your team know what the action is for.
16+
- **Mobile networks**/SIM cards that can run the service.
17+
- **Type**: USSD, SIM Toolkit, USSD push, or variable longstring. See below.
18+
- **Root code**, the shortcode used to start the session.
19+
- The menu **steps**. See below.
1820

1921
<div class="call-out call-out-info">
2022
<p>See our <a target="_blank" href="https://medium.com/use-hover/45aa9dd9dfa">blog post</a> for more on converting USSD menus into actions.</p>
2123
</div>
2224

2325
#### Creating an Action
2426

25-
Log into your Hover account and choose “New Action” from the dashboard. Give the action a memorable name. We recommend using the operator name and the type of action for easy reference (eg Tigo Send Money). Then choose the country and mobile operator your action will work with. If you’d like to support the same USSD function across multiple networks, you will need to create a unique action for each operator (eg Tigo Check Balance, MTN Check Balance) if the USSD root code and steps are different.
27+
Log into your Hover account and choose “New Action” from the dashboard. Give the action a memorable name. We recommend using the operator name and the type of action for easy reference (eg Tigo Send Money). Then choose the country and mobile operator your action will work with. If you’d like to support the same function across multiple networks, you will need to create a unique action for each operator (eg Tigo Check Balance, MTN Check Balance) if the USSD root code and steps are different.
28+
29+
Choose the **type** of menu that you are integrating. There are four types:
30+
31+
1. ###### USSD
32+
33+
A standard USSD menu that is started by dialing a shortcode and then entering choices in the menus
34+
35+
2. ###### SIM Toolkit
36+
37+
A SIM Toolkit (STK) based menu. Primarily for Safaricom MPESA in Kenya, but there are others.
38+
39+
3. ###### USSD or STK push
40+
41+
A session that is not started by dialing a shortcode or launching the STK but is instead started by an API call. Most commonly used to enter a PIN to confirm, but there can be as many steps as needed, just like a regular USSD action.
42+
43+
4. ###### Variable Longstring
44+
45+
A USSD session that does not have menus for some choices that need to be made. For example, an airtime top-up using a scratch card might be done by dialing \*123#voucherCode\* where voucherCode is the number from the scratch card.
46+
2647

2748
In **root code** enter the string a user would dial to initiate the session. These usually look like \*123# or \*123\*01#.
2849

29-
Finally enter the **steps** for your action. Each step corresponds to a selection from a USSD menu. There are three types of steps:
50+
Finally enter the **steps** for your action. Each step corresponds to a selection from a menu:
3051

3152
1. ###### Number
3253

3354
Constant choices such as entering “1” to reach My Account.
3455

35-
Corresponds to the user entering a number from a list of options and pressing “Send”. The ‘Input’ is the number Hover’s SDK will enter on behalf of the user. If there is a confirmation dialog without a number choice, create a number step with the value of a single dash `-`. This is ONLY required for dialogs in-between other steps, not at the end of the session.
56+
Corresponds to the user entering a number from a list of options and pressing “Send”. The ‘Input’ is the number Hover’s SDK will enter on behalf of the user. For SIM Toolkit actions, the number is indexed from 0, meaning the first option is 0, the second is 1 and so forth. Additionally STK number steps have an additional field "expected text". You must enter the exact (case-insensitive) text of the menu option. This allows Hover to counteract some of the bugginess of the Android STK and error correct to find the right choice.
3657

3758
2. ###### Variable
3859

@@ -46,6 +67,12 @@ Finally enter the **steps** for your action. Each step corresponds to a selectio
4667

4768
PIN steps enter the user's PIN during the session. When running an action that contains a PIN step, Hover's SDK will display a secure prompt to the user before starting the session. The PIN is encrypted and temporarily stored using the Android Keystore, entered into the session at the appropriate time and then deleted. Note: The PIN **never** leaves the device.
4869

70+
4. ###### Press OK (no choice)
71+
72+
Press the confirm button - it usually says OK or Send, but this will press it regardless of the actual text.
73+
74+
This is used for dialogs that don't have any sort of entry or choices but are just confirmation. It is rare that you will actually need to use this: in most cases Hover confirms automatically after an entry is made or at the end of the session. This is only for cases where a confirmation needs to be made in the middle of the session.
75+
4976

5077
<div class="image-with-caption columns is-variable is-5">
5178
<div class="image column is-narrow">
@@ -69,4 +96,4 @@ You must get the `READ_PHONE_STATE` permission and call `Hover.initialize()` bef
6996

7097
If you want to know if you can run a particular action on the user's SIM(s) you can call `Hover.isActionSimPresent(actionId, context);`. If you want to get a list of all your actions that will run on any of a user's present SIM cards you can call `Hover.getAllValidActions(context);` which will return a list of actions. There are also helpers for getting all the SIM cards present and for presenting a SIM choice interface to the user.
7198

72-
[Next: Install](/installation)
99+
[Next: Install](/installation)

index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ Steps can be one of three types
4040
- **Numbers** for constant choices such as entering “1” to reach My Account.
4141
- **Variables** for entries that change at runtime, such as amount to be sent.
4242
- **PIN prompt** to display a PIN entry for the user.
43+
- **Press OK** for menus where no choice or entry is made.
4344

4445
#### 2\. Install the SDK
4546

@@ -95,4 +96,4 @@ To categorize transactions as “succeeded” or “failed”, you can parse the
9596

9697
See [parsing](/parsing) for more.
9798

98-
[Next: Create Actions](/actions)
99+
[Next: Create Actions](/actions)

parsing.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,13 @@ Long (depreciated)
159159

160160
Same as updated\_timestamp
161161

162-
`transaction_extras`
162+
`input_extras`
163+
164+
Hashmap<String, String>
165+
166+
A HashMap object of all the extras you passed in using `.extra(key, value)`
167+
168+
`parsed_variables`
163169

164170
Hashmap<String, String>
165171

ussd.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,18 @@ String
4545

4646
The action name you provided for the action
4747

48-
`ussd_messages`
48+
`session_messages`
4949

5050
String\[\]
5151

5252
Text of each USSD response in order
5353

54+
`input_extras`
55+
56+
Hashmap
57+
58+
The key/value extras that you provided when starting the action
59+
5460
`request_timestamp`
5561

5662
long
@@ -77,4 +83,4 @@ If you do not have access to the SIM card or network you wish your users to use
7783

7884
If your USSD session does not seem to be running correctly and you want more visibility into what is happening you can activate the SDK debug environment by calling `.setEnvironment(HoverParameters.DEBUG_ENV)` on your `HoverParameters.Builder()`. This will prevent the Screen Blocker from displaying, allowing you to see the USSD session as it happens, and adding more logging information to the logcat. Do not interact with the session when you see it in this mode; if nothing happens you should recheck your action configuration. If it still doesn't work it is most likely a device specific issue, try with a different device and contact us so we can check the device and help you out. Please do not run debug mode in production: when users see the USSD messages flash across the screen it scares them, the blocking processing screen should always be in place.
7985

80-
[Next: Parse responses](/parsing)
86+
[Next: Parse responses](/parsing)

0 commit comments

Comments
 (0)