Skip to content

Add WhatsApp extension - #402

Merged
mattisssa merged 19 commits into
raycast:mainfrom
vimtor:main
Dec 6, 2021
Merged

mattisssa merged 19 commits into
raycast:mainfrom
vimtor:main

Conversation

@vimtor

@vimtor vimtor commented Nov 21, 2021 •

Copy link
Copy Markdown
Contributor

Description

This extension aims to interact with WhatsApp application. For now, it only has one command which grabs all your Apple contacts and shows them to open in WhatsApp desktop or web apps. Also, it includes functionality to pin contacts so you can access them quickly.

Since the extension now only has that command I did not name it "WhatsApp".

The first time the extension asks for "Contact" permissions to grab all the contacts, which takes 4-10 seconds the first time, after this it gets cached. I am no Mac expert, so maybe there is a better way to get these contacts from JavaScript.

As a side note, I saw that the built-in Raycast list filter ignores phone numbers (or numbers in general). I am unsure about how to deal with this since creating a custom filter for this seems like an overkill.

Type of change

  • New extension

Screencast

For privacy reasons I decided to only include images so I can blur them using CleanShot

CleanShot 2021-11-21 at 13 34 26

CleanShot 2021-11-21 at 18 30 38@2x
CleanShot 2021-11-21 at 19 06 17@2x

Checklist

@pernielsentikaer pernielsentikaer added the new extension Label for PRs with new extensions label Nov 22, 2021
@vimtor

vimtor commented Nov 22, 2021

Copy link
Copy Markdown
Contributor Author

I was thinking about making this extension simpler by removing the Apple Contacts integration and adding instead the following commands:

  • Add Chat
  • Add Group (or as an option in the "Add Chat" command)
  • Open Chat

This provides full flexibility and will allow users to add groups (not possible currently) or use the extension without Apple's Contacts app. That being said adding all the contact manually can be tedious so I may add a command "Import Contacts".

@EliasGcf

Copy link
Copy Markdown

This looks awesome, congratulations!

@mattisssa mattisssa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey! Thanks for the contribution 👍

I tried to Create Chat that already exists with name test, and in Open Chat this chat is titled as Test, but in the WhatsApp app it is called differently (as I titled it in contacts). Not sure if we can do anything here, let me know if it's possible to check and improve.

I'm not sure what can be wrong here, but the Import Contacts takes very long, for me it was about 3 mins. Seeing the animating toast for 3 mins does not feel great, let me think what can be better here.
CleanShot 2021-11-23 at 17 06 03@2x

Does it work for you properly?

@mattisssa

mattisssa commented Nov 23, 2021 •

Copy link
Copy Markdown
Contributor

As a side note, I saw that the built-in Raycast list filter ignores phone numbers (or numbers in general). I am unsure about how to deal with this since creating a custom filter for this seems like an overkill.

Yeah, this is the bug that will be fixed with the next release 😉
But! You have to include these numbers in keywords for List.Item since our subtitles don't count for filtering. Better to include the version with "+" and just a regular number.

@vimtor

vimtor commented Nov 23, 2021 •

Copy link
Copy Markdown
Contributor Author

Hey @mattisssa!

  1. I'm not sure what is the problem you faced when using the command Create Chat with test as a name. I think you should be able to have 2 contacts with the same name, since you can meet 2 people with the same name. If you are referring to forcing the name to match the WhatsApp one, this is currently impossible because WhatsApp does not offer any kind of public API. Once they release it we can simply use it in the Open Chat and modify the Create Chat or Create Group to actually create a group in WhatsApp.
  2. The Import Contacts takes a long time for me too. I am fairly new to the Apple ecosystem and AppleScript, but I did not find a faster way to retrieve the contact information. The built-in Search Contacts is super fast, so my guess is that there is a better solution out there.
  3. I will include the phone number with and without the + symbol in the keywords so they work in the next release 😄

Let me know, if you find a better way to solve the 2nd problem. I will investigate it further this weekend.

@mattisssa

Copy link
Copy Markdown
Contributor
  1. ok 👍
  2. Do we really need this command in your extension? I'm not a heavy whats app user, but not sure if it's really important to have one since it's such a slow 😃
  3. Do this before the publishing command please, once the release will be delivered your command will work as expected automatically 😉

I've noticed another issue in your extension. I created a group with a name and a Random "Group Code" (Should this be random or how does it work?).
I can see the group in "Open Chat" command, but once I open the group I see this:

CleanShot 2021-11-23 at 21 59 23@2x

@mattisssa mattisssa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Requesting changes for the keywords we discussed in the comments

@vimtor

vimtor commented Nov 23, 2021

Copy link
Copy Markdown
Contributor Author
  1. It's not really necessary to be honest. However, without it will be kind of slow to setup since you will have to create your most common contacts manually. I will try something like node-mac-contacts to see if it loads faster. I am open to delete the command, tell me what you think 😄
  2. 👍
  3. I forgot to a README.md explaining how to get the WhatsApp group code. I sent you a Slack message with a real WhatsApp group I created.

If you don't have WhatsApp I can show you in a Slack call how the extension works.

@vimtor

vimtor commented Nov 25, 2021

Copy link
Copy Markdown
Contributor Author

The problem here is that WhatsApp does not have an available API yet.

The Create commands just add the group or contact to the extension so you can use them in the Open Chat command. That's why I added the Import Contacts command. There is not way to create groups from outside WhatsApp.

I can rename the commands to Add Group and Add Contact so it becomes clear (or even Add Existing Group).

Now maybe you understand why I added the Import Contacts command.

Sorry for the confusion :)

@mattisssa

mattisssa commented Nov 25, 2021 •

Copy link
Copy Markdown
Contributor

@vimtor Ooookay, I thought this is the way it works 😄 👍
Yes, these commands should be definitely renamed, because having "Create" in the title assumes creation and does not add to the extension. I'd call them "Add Existing Group" and "Add Contact" as you mentioned. 👍

About "Import Contacts" command I'll be back a little bit later, want to discuss this with the team again.

@vimtor

vimtor commented Nov 25, 2021

Copy link
Copy Markdown
Contributor Author

Awesome! I will change the command names and explain them a bit more in the README.

Let me know if you have some ideas about the Import Contacts. I thought about compiling some native code, but I am unsure if that will have security implications for you :)

@vimtor

vimtor commented Nov 29, 2021

Copy link
Copy Markdown
Contributor Author

Any news of the Import Contacts command?

I think we can omit it if we want, since the extension works without it. It is a nice to have but non blocking.

@vimtor

vimtor commented Dec 6, 2021

Copy link
Copy Markdown
Contributor Author

Hey @mattisssa I removed the Import Contacts command since it makes the whole thing more complicated to understand and it was simply a patch before WhatsApp releases their official API

Feel free to publish the extension :)

@mattisssa

Copy link
Copy Markdown
Contributor

Hey @vimtor! Sorry for the long awaited, we published a message with a small info that the entire team was off for a while. Let me check everything again and finally make the merge

@mattisssa
mattisssa self-requested a review December 6, 2021 20:52

@mattisssa mattisssa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ok, I'm approving it. But let's, please do the proper import for contacts and groups in the future, because it's really too complex to configure everything before you can use the commands.

I assume people will probably just use the WhatsApp application rather than the extension because making this manual import will take a long time.

@mattisssa
mattisssa merged commit ce960b8 into raycast:main Dec 6, 2021
@raycastbot

Copy link
Copy Markdown
Collaborator

georgjaehnig added a commit to georgjaehnig/raycast-extensions that referenced this pull request Jul 6, 2024
- Remove rollup-plugin-git-info.
- Fix: Add new.
- Fix: Add back ticks.
- Remove gitCommitHash.
- Create and use new GitLogger.
- Remove.
- Move methods.
- Remove commitHash from urls.
- Merge branch \'master\' into new-git-logger
- Merge pull request raycast#402 from trovu/add-git-info-to-data
- Add getGitInfo.
- Format with new prettier.
raycastbot added a commit that referenced this pull request Jul 9, 2024
* Add trovu extension

* Update trovu extension

- Use symlinked imports.
- Symlink used imports.
- Restrict Node version to 21.3.

* Also add Query parser.

* Update trovu extension

- Add countries-list dependency.
- Add Helper.js.

* Remove owner.

* Update trovu extension

- Title Case.
- Add exceptions for linter.

* Update trovu extension

- Use new prettier settings on Raycast-relevant files.
- Change to prettier settings from Raycast.

* Update trovu extension

- Merge pull request #401 from trovu/separate-version-logger
- Remove unused imports.
- Merge branch \'master\' into separate-version-logger
- Use also here.
- Remove old code.
- Use new GitLogger.
- Add new GitLogger.
- Merge pull request #400 from trovu/rename-trovu-web
- npm ci.
- Rename in links.
- Rename in docker makefile.
- Rename in package.
- .de.a: Add affiliate.
- ue5: Add Unreal Engine 5 Documentation.
- Add namespace prefix to examples.
- Add plugin to config.
- npm install --save-dev @typescript-eslint/parser @typescript-eslint/eslint-plugin
- Format.
- Merge to 1 line.
- Double quotes also here.
- Change also eslint to double quotes.
- Merge pull request #395 from trovu/add-classes-to-raycast
- Use prettier on md, too.
- Use new prettierrc settings on remaining files.

* Update trovu extension

- Add more dependencies from core.
- Add more used modules.
- Use dir structure as in core.
- Depend on same versions as core.
- npm i
- Set commit hash only in browser context.

* Add another used module.

* Update trovu extension

- Catch non-existing navigator.
- Check for document happens before.

* Update trovu extension

- Remove rollup-plugin-git-info.
- Fix: Add new.
- Fix: Add back ticks.
- Remove gitCommitHash.
- Create and use new GitLogger.
- Remove.
- Move methods.
- Remove commitHash from urls.
- Merge branch \'master\' into new-git-logger
- Merge pull request #402 from trovu/add-git-info-to-data
- Add getGitInfo.
- Format with new prettier.

* Add more imports.

* Link to single files.

* Update trovu extension

- File format.
- Add lodash.

* Update CHANGELOG.md and optimise images

---------

Co-authored-by: raycastbot <[email protected]>
colebemis added a commit to colebemis/raycast-extensions that referenced this pull request Nov 6, 2024