-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fully qualitfied USSD command #14
Comments
Hey @ephraimm - sorry about the delayed response. According to the Africa's Talking docs on the text param: "This shows the user input. It is an empty string in the first notification of a session. After that, it concatenates all the user input within the session with a * until the session ends." Because of this limitation on the provider side, I don't think this feature will be currently possible. I will try reaching out to AT to see if they would be willing to provide the full string on the session initiation. This is a feature that has been requested by our customers as well, so I am currently trying to see if I can do something like this on our Ghana Hubtel app. I'll keep this thread posted if I have any success on the AT or Hubtel fronts. |
Thanks for the info. so this is something that is managed by the networks or by WASPs (AT and the like) or is it both? |
@ephraimm you could probably make it work by transforming your input into something the library expects (which was initially built with the Africa's Talking API in mind): function covertFullSessionCommand (command) {
const [serviceCode, ...rest] = command.slice(1, -1).split('*');
return { serviceCode, text: rest.join('*') }
}
const { serviceCode, text } = covertFullSessionCommand('*1234*1*1*9876#');
console.log(serviceCode, text);
menu.run({ serviceCode, text, phoneNumber: '07...', sessionId: 'dsfdsf' }, callback); Does this address your problem? This is obviously a hack, but let me know if it works for you. I think the ideal thing would be to re-write the library in such a way as USSD API providers can be implemented as adapters on top of a provider-agnostic base. Maybe if I get time I could work on that, but I can't give out an ETA. |
How do I handle a user sending through a full ussd command on session initialisation?
where 1234 is the shortcode and 119876 the preconfigured responses?
The text was updated successfully, but these errors were encountered: