0

Whatsapp allows to send a message to any number if I browse to https://wa.me/. That displays a web page that has a button that navigates to 'whatsapp://send?phone='.

I want to have a shortcut that asks for the number and then opens the whatsapp:// link (without going through the web page).

I tried to use 'HTTP Request Shortcut' (https://play.google.com/store/apps/details?id=ch.rmy.android.http_shortcuts), but it only accepts http links and then just shows the response. Tried to use some activity shortcuts, but I can't find one that has the whatsapp activity to open a chat with a prompt to a number.

1
  • If something should "ask for the number" you need an app to do so (unless Whatsapp is capable of asking for the number itself).
    – Robert
    Dec 9, 2020 at 11:57

1 Answer 1

2

I'm the creator of the HTTP Request Shortcuts app, and I believe it can be used for what you're describing. You can try this:

  1. Open the HTTP Shortcuts app
  2. Click the + button at the bottom right to create a new shortcut
  3. In the dialog that pops up select "Scripting Shortcut"
  4. Give the shortcut a name (and a description and different icon if you want)
  5. Click on "Scripting" to open the Scripting editor
  6. Enter the following JavaScript code:
    const number = prompt('Enter the number');
    sendIntent({
    type: 'activity',
    action: 'android.intent.action.VIEW',
    dataUri: 'whatsapp://send?phone='+number,
    });
  7. Save your changes.

You can then run this shortcut from within the app, or place it on your home screen. When you click it, it should prompt you to enter a number, and will then invoke the URL 'whatsapp://send?phone=' with the number appended.

Hope this helps. For more information regarding Scripting in the HTTP Request Shortcuts app see the official documentation here: https://http-shortcuts.rmy.ch/scripting

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .