Skip to content
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

Send a Message / WhatsApp block #15050

Merged
merged 32 commits into from
Jun 27, 2020
Merged

Send a Message / WhatsApp block #15050

merged 32 commits into from
Jun 27, 2020

Conversation

apeatling
Copy link
Member

@apeatling apeatling commented Mar 19, 2020

Note: New commits require the new files added in this PR to be re-added to the Fusion generated diff (D44901-code) as the WordPress.com gating (D44978-code) for the block depends on the resulting build

This block provides two things. The first is a parent "Send a Message" block that is the container for all messaging service inner blocks (very similar to the social icons block). The second is a WhatsApp Button block that provides the primary functionality for connecting to WhatsApp.

So far the "Send a Message" block is limited only to WhatsApp as a service, so this inner block is inserted by default. Going forward we can easily add more services.

There is a default "WhatsApp Button" variation of the "Send a Message" block that means that "WhatsApp Button" shows up in the inserter, not "Send a Message". In the future we can also provide other service variations so they appear in the inserter, rather than a generic "Send a Message" block.

This is how it works (note on mobile phones, tapping the button will open WhatsApp directly):

2020-05-26 09 39 57

In this version of the block, I have hidden the child block inserter to the right of the WhatsApp button that would be used to insert buttons for other services. There is only one service, so it's not useful.

One caveat -- variations do not work via the / quick inserter, so you will not see the "WhatsApp Button" block appear here. This is being tracked here and I'll see what I can do to move this along: WordPress/gutenberg#20583

Testing instructions:

  • Insert a WhatsApp button
  • Add a phone number that is associated with a WhatsApp account
  • Publish the post
  • Confirm that clicking the button opens WhatsApp and the phone number and initial message look correct.
  • Try on a mobile device and confirm that WhatsApp opens correctly.
  • Adjust the color settings and confirm that this changes correctly.
  • Insert multiple buttons on the page and confirm they all work separately and correctly.

Proposed changelog entry for your changes:

  • Introduced a new WhatsApp button block to allow your users to send you messages on WhatsApp from your website.

@jetpackbot
Copy link

jetpackbot commented Mar 19, 2020

Warnings
⚠️

pre-commit hook was skipped for one or more commits

⚠️ The Privacy section is missing for this PR. Please specify whether this PR includes any changes to data or privacy.

This is an automated check which relies on PULL_REQUEST_TEMPLATE. We encourage you to follow that template as it helps Jetpack maintainers do their job. If you think 'Testing instructions' or 'Proposed changelog entry' are not needed for your PR - please explain why you think so. Thanks for cooperation 🤖

E2E results is available here (for debugging purposes): https://jetpack-e2e-dashboard.herokuapp.com/pr-15050

Generated by 🚫 dangerJS against a24fc30

@jeherve jeherve added [Block] Send a message [Type] Feature Request [Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack labels Mar 19, 2020
@apeatling
Copy link
Member Author

I'm working on this as a 20% time thing, and to help more rapidly improve my Gutenberg knowledge. It's outside of our current team cycle work.

@apeatling apeatling marked this pull request as draft April 10, 2020 17:59
@apeatling apeatling force-pushed the add/send-a-message-block branch from 3f31510 to a30d5c8 Compare May 21, 2020 16:52
@davemart-in davemart-in changed the title WIP: Add Send a Message Block WhatsApp block May 26, 2020
@apeatling apeatling marked this pull request as ready for review May 26, 2020 14:58
@apeatling apeatling changed the title WhatsApp block Send a Message / WhatsApp block May 26, 2020
@apeatling apeatling requested a review from a team May 26, 2020 16:54
@apeatling apeatling requested a review from amamujee May 26, 2020 17:45
@kraftbj kraftbj removed the request for review from a team May 26, 2020 22:28
@aaronrobertshaw
Copy link
Contributor

Very nice @apeatling!

I've taken this for a bit of a spin and it works great.

There was only one minor issue. When I pushed WordPress' version back to 5.3 or earlier, the appender is visible and functional whereas its hidden for the time being in the current version of WP.

Related to that, even using the latest version of WP, if you expand the three dots toolbar menu, you can still choose to duplicate the inner Whatsapp block within the parent Send A Message block. If we are choosing to hide the appender for now, would it make sense to also hide that option?

@creativecoder creativecoder linked an issue Jun 8, 2020 that may be closed by this pull request
@aaronrobertshaw aaronrobertshaw self-assigned this Jun 8, 2020
@matticbot
Copy link
Contributor

Caution: This PR has changes that must be merged to WordPress.com
Hello apeatling! These changes need to be synced to WordPress.com - If you 're an a11n, please commandeer, review, and approve D44901-code before merging this PR. Thank you!
This revision will be updated with each commit to this PR

…a Message block parent. This will allow us to support other services within the same block in the future, while providing service variations so that users can directly insert the buttons they want from the inserter.
@jeherve jeherve added the [Status] Ready to Merge Go ahead, you can push that green button! label Jun 25, 2020
@apeatling
Copy link
Member Author

apeatling commented Jun 25, 2020

The ordering on that list surprised me, I expected to find my country code closer to the top :)

@jeherve What do you see when you go to https://https://public-api.wordpress.com/geo/ ? Your country code should be auto selected so you don't have to go through the list.

@apeatling
Copy link
Member Author

Our other buttons allow you to add line breaks within the button text. Could we add this here as well?

Done. 👍

@apeatling
Copy link
Member Author

The block preview for the Send a message block includes some details about the inner block that we probably should not be displaying:

This block should not appear in the main inserter, which version of Gutenberg was this in?

@apeatling
Copy link
Member Author

@jeherve If you can give this a final approval I'll merge this and follow up in separate PRs.

@apeatling apeatling requested a review from jeherve June 25, 2020 19:49
@apeatling apeatling added [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. and removed [Status] Ready to Merge Go ahead, you can push that green button! labels Jun 25, 2020
@folletto
Copy link
Contributor

For some reason the button isn't showing up on the Jurassing Ninja I tried to spin up, so apologies but I couldn't test this.

Privacy question: how are we storing that phone number?
I see it's redirecting so I imagine that the phone number is going to be provided in clear... is there any way for this to have the phone number protected, so it's not visible from the outside as a site visitor?

I know it might not, but if possible, yet it would be a great feature if it could prevent scraping — as I think most of the cases require the number to be in clear.

@jeherve
Copy link
Member

jeherve commented Jun 26, 2020

For some reason the button isn't showing up on the Jurassic Ninja I tried to spin up, so apologies but I couldn't test this

Could you go to Settings > Jetpack Constants and ensure that the Beta checkbox is checked?

how are we storing that phone number?

It's stored in the post content, and is indeed available to any site visitor who can click on the button and see what phone number the button sends you to.

That's how the official Whatsapp button works as well:
https://faq.whatsapp.com/general/chats/how-to-use-click-to-chat/

I don't know if I would consider this a privacy issue though; if you add a Whatsapp button to your site, I would assume that's because you do want people to contact you?

@fgiannar
Copy link
Contributor

For some reason the button isn't showing up on the Jurassing Ninja I tried to spin up, so apologies but I couldn't test this.

Hi @folletto , in order to be able to see the button you could try going to Admin->Settings->Jetpack Constants and setting the JETPACK_BETA_BLOCKS to true.

Screenshot 2020-06-26 at 2 15 52 PM

Hope this helps :)

@apeatling You could possibly add this to the test instructions as well if you wish :)

@folletto
Copy link
Contributor

folletto commented Jun 26, 2020

I don't know if I would consider this a privacy issue though; if you add a Whatsapp button to your site, I would assume that's because you do want people to contact you?

I wouldn't consider a privacy "issue" because as you stated it's the default WhatsApp behaviour. I'm saying that if we provide a way that avoids scraping, we have a major privacy benefit (and yes, benefit > issue 😉 ).

Being open to receive a customer message doesn't mean you're open to receive any message from automated scrapers, robocalls, etc. Especially relevant if you're a small/sole business.

There are three layers here:

  1. Visible to anyone inspecting, and to any scraper
  2. Visible to anyone inspecting, but shielded from scrapers
  3. Private

If we are able to have a block that does (3), it would be an amazing feature that we should advertise. Providing (2) would be regardless nice to help protect our users. Doing (1) is the status quo, so it's ok, it's just not very nice.

@jeherve
Copy link
Member

jeherve commented Jun 26, 2020

What do you see when you go to https://public-api.wordpress.com/geo/ ?

I do see my country code (well the one where I'm proxied at the moment), but it doesn't seem to get picked up by the picker. This happens whether I am proxied or not.

This block should not appear in the main inserter, which version of Gutenberg was this in?

I'm seeing this on WP 5.4.2, no Gutenberg. It does not seem to happen in WP 5.3.4.

@jeherve jeherve added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. labels Jun 26, 2020
Copy link
Member

@jeherve jeherve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be good to merge. We can keep iterating in follow-up PRs.

@apeatling apeatling merged commit 57fc4e3 into master Jun 27, 2020
@apeatling apeatling deleted the add/send-a-message-block branch June 27, 2020 12:39
@matticbot matticbot added [Status] Needs Changelog and removed [Status] Ready to Merge Go ahead, you can push that green button! labels Jun 27, 2020
@apeatling
Copy link
Member Author

I'm saying that if we provide a way that avoids scraping, we have a major privacy benefit (and yes, benefit > issue 😉 ).

@folletto I'll see if there are any ways to obfuscate the phone number. Another option is to be clear in the interface that your phone number will be exposed on your website.

@folletto
Copy link
Contributor

Good point. If we can't obfuscate, let's make that clear! :)

@jeherve
Copy link
Member

jeherve commented Jun 29, 2020

r209741-wpcom

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Send a message Blocks V2 [Focus] Blocks Issues related to the block editor, aka Gutenberg, and its extensions developed in Jetpack Touches WP.com Files [Type] Feature Request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WhatsApp / Send a Message Block
8 participants