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

New button type: COPY_CODE #118

Open
brunopedrosa opened this issue Aug 29, 2023 · 5 comments
Open

New button type: COPY_CODE #118

brunopedrosa opened this issue Aug 29, 2023 · 5 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed java Pull requests that update Java code

Comments

@brunopedrosa
Copy link

brunopedrosa commented Aug 29, 2023

Is the new 'COPY_CODE' button type working? (edited: it seems not work)

@github-actions
Copy link

Hello and welcome! We're glad to see that you've opened your first issue. We appreciate your contribution and would love to hear more about the problem you're experiencing. Our team is actively monitoring this repository and we will do our best to respond to your issue as soon as possible. Thank you for using our project and we look forward to working with you!

@brunopedrosa
Copy link
Author

Caused by: com.fasterxml.jackson.databind.exc.InvalidTypeIdException: Could not resolve type id 'COPY_CODE' as a subtype of com.whatsapp.api.domain.templates.Button: known type ids = [Button, PHONE_NUMBER, QUICK_REPLY, URL] (for POJO property 'buttons')

@brunopedrosa brunopedrosa changed the title New button type: coupon New button type: COPY_CODE Aug 30, 2023
@Bindambc
Copy link
Owner

Bindambc commented Sep 5, 2023

Hello @brunopedrosa, thank you for informing. This is a new feature that has been added to the API as per the changelog.

API documentation:
https://developers.facebook.com/docs/whatsapp/business-management-api/authentication-templates

I'll be implementing this feature soon. If you've already implemented something related, feel free to share.

@Bindambc Bindambc added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers java Pull requests that update Java code labels Sep 5, 2023
@brunopedrosa
Copy link
Author

Hello @Bindambc,

It seems to be working, but I'm not sure if the code is 100%. It would be a good idea to give it a review.

package com.whatsapp.api.domain.templates;

import java.util.List;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.whatsapp.api.domain.templates.type.ButtonType;

/**
 * The type Quick reply button.
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
public class CopyCodeButton extends Button {
	
    @JsonProperty("example")
    private List<String> urlExample;
    
    /**
     * Instantiates a new Copy code button.
     */
    protected CopyCodeButton() {
        super(ButtonType.COPY_CODE);
    }

    /**
     * Instantiates a new Copy code button.
     *
     * @param text the text
     */
    public CopyCodeButton(String text) {
        super(ButtonType.COPY_CODE, text);
    }

	public List<String> getUrlExample() {
		return urlExample;
	}

	public void setUrlExample(List<String> urlExample) {
		this.urlExample = urlExample;
	}
}
package com.whatsapp.api.domain.templates.type;

/**
 * The enum Button type.
 */
public enum ButtonType {
    /**
     * Phone number button type.
     */
    PHONE_NUMBER,
    /**
     * Url button type.
     */
    URL,
    /**
     * Quick reply button type.
     */
    QUICK_REPLY,
    /**
     * Copy code button type.
     */
    COPY_CODE
    
}

@PenugondaJayanthi123
Copy link

Can you assign this issue to me?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed java Pull requests that update Java code
Projects
None yet
Development

No branches or pull requests

3 participants