I am developing a B2C application for local business. I will be developing separate apps for businesses and customers but to cater to the customers who do not have the app yet, I wish to provide Businesses with the functionality that they can send invoices to their customer's WhatsApp through my Business App from their WhatsApp Number.

How can I achieve this?

Thanks in advance

Tag:ios, android, react-native, facebook, whatsapp

2 comments.

  1. Sam Chen

    It depends on what format your invoice is, if it is plain text or image, for Android you can just use Intent to share it to WhatsApp

    1. Share Text

    public void onClick(View view) { String packageName = "com.tencent.mm"; //you can try "com.whatsapp" for WhatsApp or "com.facebook.orca" for Messenger if (isAppInstalled(packageName)) { //if app found String text = "I love you"; Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_TEXT, text); intent.setPackage(packageName); startActivity(intent); } else { Toast.makeText(view.getContext(), "WeChat is not installed", Toast.LENGTH_SHORT).show(); } } private boolean isAppInstalled(String packageName) { boolean installed = true; try { getPackageManager().getPackageInfo(packageName, 0); //if package not found, exception will be thrown } catch (PackageManager.NameNotFoundException e) { installed = false; } return installed; }

    2. Share Image

    shareButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("image/*"); intent.putExtra(Intent.EXTRA_STREAM, imageUri); //uri from loading onto the page intent.setPackage(packageName); //such as "com.tencent.mm" startActivity(intent); } });
    1. Samarth Shrivastava

      Thank you so much, invoice will be in plain text and a link to play store and app store

Add a new comment.