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

Is this project still active? Crate name whatsapp reserved for the Cloud API #10

Open
NewtTheWolf opened this issue Sep 27, 2024 · 25 comments

Comments

@NewtTheWolf
Copy link

Hello!

I’ve noticed that this project aims to implement the WhatsApp Cloud API. I’ve reserved the crate name whatsapp on crates.io to prevent it from being used by unofficial or unrelated libraries.

Is this project still active? If so, would you like to take ownership of the whatsapp crate name for the official WhatsApp Cloud API library? I would be happy to transfer it to ensure that the crate name reflects the official implementation of the API.

Looking forward to your response!

@sajuthankappan
Copy link
Owner

hi @NewtTheWolf ,

Yes, This project is very much active. However I haven't done much activity for the past couple of months, as I'm held up with my my work stuff.

I'm not sure about taking the ownership of the whatsapp crate name, without knowing the real expectations on this. Would be happy to understand the expectations and take it from there.

Thanks for reaching out to me.

@NewtTheWolf
Copy link
Author

Hey @sajuthankappan,

Thank you for getting back to me!

I have a few expectations, but they are quite simple, and I’d also be happy to contribute to the project myself. Here’s what I had in mind:

  1. Fix a typo: The main struct is currently named "WhatasppClient" instead of "WhatsappClient."
  2. Add types for Facebook's verification requests to ensure better type safety and usability.
  3. Introduce support for dynamically changing the PhoneNumberID and AccessToken if needed, using something like client.set_key("key-for-this-request").

Looking forward to hearing your thoughts on this!

Best regards,
Newt

@NewtTheWolf
Copy link
Author

i also would create Issues for the things

like in my fork i already fixxed the Typo and added the Types for the Verification Request, if you want i can create a Issue and a PR for it

@sajuthankappan
Copy link
Owner

Yes please, @NewtTheWolf .
Definitely appreciate issues / PRs. Thanks.

Regards,
Saju

@sajuthankappan
Copy link
Owner

sajuthankappan commented Nov 27, 2024

Hey @sajuthankappan,

Thank you for getting back to me!

I have a few expectations, but they are quite simple, and I’d also be happy to contribute to the project myself. Here’s what I had in mind:

  1. Fix a typo: The main struct is currently named "WhatasppClient" instead of "WhatsappClient."
  2. Add types for Facebook's verification requests to ensure better type safety and usability.
  3. Introduce support for dynamically changing the PhoneNumberID and AccessToken if needed, using something like client.set_key("key-for-this-request").

Looking forward to hearing your thoughts on this!

Best regards, Newt

1 was a nasty typo from my side. My bad. It somehow escaped my eyes for all these days :)

@sajuthankappan
Copy link
Owner

sajuthankappan commented Nov 27, 2024

Hey @sajuthankappan,

Thank you for getting back to me!

I have a few expectations, but they are quite simple, and I’d also be happy to contribute to the project myself. Here’s what I had in mind:

  1. Fix a typo: The main struct is currently named "WhatasppClient" instead of "WhatsappClient."
  2. Add types for Facebook's verification requests to ensure better type safety and usability.
  3. Introduce support for dynamically changing the PhoneNumberID and AccessToken if needed, using something like client.set_key("key-for-this-request").

Looking forward to hearing your thoughts on this!

Best regards, Newt

Hi @NewtTheWolf ,

Regarding 3, this looks sensible to me, and should be an easy change.
I also looked at the official Whatsapp nodejs sdk documentation and I could see they also have options to do this.

https://whatsapp.github.io/WhatsApp-Nodejs-SDK/api-reference/whatsapp/updateSenderNumberId
https://whatsapp.github.io/WhatsApp-Nodejs-SDK/api-reference/whatsapp/updateAccessToken

We can follow a similar style (of course,following rust conventions)..

Regarding, 2, this is probably a larger change as the current code do not have the phone numbers APIs at all (request code and verify code methods).. I could do it my spare time.

But, if you have already made these changes, pls feel free to send a PR. Will be more than happy :)

Regards,
Saju

@sajuthankappan
Copy link
Owner

sajuthankappan commented Nov 27, 2024

Hey @sajuthankappan,
Thank you for getting back to me!
I have a few expectations, but they are quite simple, and I’d also be happy to contribute to the project myself. Here’s what I had in mind:

  1. Fix a typo: The main struct is currently named "WhatasppClient" instead of "WhatsappClient."
  2. Add types for Facebook's verification requests to ensure better type safety and usability.
  3. Introduce support for dynamically changing the PhoneNumberID and AccessToken if needed, using something like client.set_key("key-for-this-request").

Looking forward to hearing your thoughts on this!
Best regards, Newt

1 was a nasty typo from my side. My bad. It somehow escaped my eyes for all these days :)

The typo in name is now fixed in the main branch.. @NewtTheWolf

@NewtTheWolf
Copy link
Author

oh perfect, i will create the PR's Tomorrow!

btw, whats now about the Crate name? i would love to give it to this crate

@sajuthankappan
Copy link
Owner

Made one more commit: add methods set_access_token and set_phone_number_id for WhatsappClient

hope this helps @NewtTheWolf

@sajuthankappan
Copy link
Owner

oh perfect, i will create the PR's Tomorrow!

btw, whats now about the Crate name? i would love to give it to this crate

Regarding crate name, to be honest, I'm not too bothered on the crate name :)
But, if you would like, you can transfer it to me. I'll be more than happy to use the "whatsapp" crate name :D

@NewtTheWolf
Copy link
Author

Can you give me your Crates email? If you want you also can send it to me via Email to [email protected]

@sajuthankappan
Copy link
Owner

Can you give me your Crates email? If you want you also can send it to me via Email to [email protected]

Sent u a mail.

@sajuthankappan
Copy link
Owner

@NewtTheWolf
Added one more commit: add methods request_code and verify_code for WhatsappClient

I haven't tested the code myself yet. Will do before I publish the crate.
In the meanwhile, please take a look and let me know your feedback..

@NewtTheWolf
Copy link
Author

hello, i will test this tomorrow (CET) but it already looks greate!

one thing is missing, i created it somehow (igonre the rocket stuff): https://github.com/NewtTheWolf/whatsapp-cloud-api-rs/blob/main/src/models/verification.rs for this: facebook webhook verify notification

@sajuthankappan
Copy link
Owner

Hi @NewtTheWolf

Regarding the webhook verification, I have done this in my real project (which also uses this crate)..

The struct code goes as below..

#[derive(Deserialize, Debug)]
pub struct WhatsppHookVerificationRequest {
    #[serde(rename = "hub.mode")]
    pub mode: String,
    #[serde(rename = "hub.verify_token")]
    pub verify_token: String,
    #[serde(rename = "hub.challenge")]
    pub challenge: String,
}

I just thought this is way too simple (just one struct :P), while wroting this code, and hence kept it in my real project itself, not this crate. Now, I see this is also a good candiate for others to reuse. I'll move this also to this crate.

This enabled me to respond to the the webhook easily, with straightforward de-serialization of the request (I don't use rocket though)..

Hope this helps..

@NewtTheWolf
Copy link
Author

this is awesome! thanks <3

about the crate name, maybe fork your own repo and name it whatsapp-rs and in the Cargo.toml name it whatsapp so no one gets confused and maybe mark this crate afterwards as depricated (or you just can push to Both crates)

never had this usecase 😆 but the whatsapp name would fit this project the best!

@sajuthankappan
Copy link
Owner

about the crate name, maybe fork your own repo and name it whatsapp-rs and in the Cargo.toml name it whatsapp so no one gets confused and maybe mark this crate afterwards as depricated (or you just can push to Both crates)

Sounds good to me also.. I would rather keep one crate to keep things simple. So, let it be just 'whatsapp'! Thank you :)

@NewtTheWolf
Copy link
Author

TODO:

  1. Rename File at https://github.com/sajuthankappan/whatsapp-cloud-api-rs/blob/main/src/whatspapp_client.rs to whatsapp_client.rs

Feature:
Make it Possible to Specifie the API Version (defaults to version X) X = v20 as example

@sajuthankappan
Copy link
Owner

TODO:

  1. Rename File at https://github.com/sajuthankappan/whatsapp-cloud-api-rs/blob/main/src/whatspapp_client.rs to whatsapp_client.rs

Oops. That was bad again :) Done.

@sajuthankappan
Copy link
Owner

Feature: Make it Possible to Specifie the API Version (defaults to version X) X = v20 as example

This is something nagging my mind also for a long time. Technically an easy thing to expose. But, I wasn't sure if this is the right thing to do..

Saying this.. now I see the official Whatsapp node.js sdk also exposes this capability (https://whatsapp.github.io/WhatsApp-Nodejs-SDK/api-reference/whatsapp/version)

So I'll do something similar :)

@NewtTheWolf
Copy link
Author

haha

maybe just do a info in the readme that the crate is designed for the default version, but if a user wants to use a diffrent version then on its own risk

@sajuthankappan
Copy link
Owner

maybe just do a info in the readme that the crate is designed for the default version, but if a user wants to use a diffrent version then on its own risk

Yeah. Sounds like a good idea..

btw, I read the node.js sdk a little too quick. It looks like they only have the getter, not the setter.
Anyways, I'm going to expose a setter, and see if this generates an issue. So far in my experience, I haven't noticed any issues, at least while going upwards in version. Let's see..

btw, the latest fb cloud api version seems 20. But, their cloud API documentation is still referring to 17 (which I also used in the code now)

@sajuthankappan
Copy link
Owner

While doing my testing, i'll also upgrade the code to refer V20, and see if this continues to work..

@NewtTheWolf
Copy link
Author

in the JS SDK you set the version via the env: https://whatsapp.github.io/WhatsApp-Nodejs-SDK/

@sajuthankappan
Copy link
Owner

in the JS SDK you set the version via the env: https://whatsapp.github.io/WhatsApp-Nodejs-SDK/

Well. Perfect!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants