Skip to content

Commit

Permalink
Merge pull request #1 from Ahriman/fix-update-message-template-endpoint
Browse files Browse the repository at this point in the history
Fix endpoint for updating message templates
  • Loading branch information
Ahriman authored May 23, 2024
2 parents 8e20a52 + 708472a commit 12920af
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,13 @@ public Template createMessageTemplate(String whatsappBusinessAccountId, MessageT
/**
* Update message template message template id response.
*
* @param whatsappBusinessAccountId the whatsapp business account id
* @param messageTemplateId the message template id
* @param messageTemplate the message template
* @return the message template id response
*/
public Template updateMessageTemplate(String whatsappBusinessAccountId, String messageTemplateId, MessageTemplate messageTemplate) {
public Template updateMessageTemplate(String messageTemplateId, MessageTemplate messageTemplate) {

return executeSync(whatsappBusinessManagementApiService.updateMessageTemplate(apiVersion.getValue(), whatsappBusinessAccountId, messageTemplateId, messageTemplate));
return executeSync(whatsappBusinessManagementApiService.updateMessageTemplate(apiVersion.getValue(), messageTemplateId, messageTemplate));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,12 @@ public interface WhatsappBusinessManagementApiService {
/**
* Update message template call.
*
* @param whatsappBusinessAccountId the whatsapp business account id
* @param messageTemplateId the message template id
* @param messageTemplate the message template
* @return the call
*/
@POST("/{api-version}/{whatsapp-business-account-ID}/message_templates/{message-template-id}")
Call<Template> updateMessageTemplate(@Path("api-version") String apiVersion, @Path("whatsapp-business-account-ID") String whatsappBusinessAccountId, @Path("message-template-id") String messageTemplateId, @Body MessageTemplate messageTemplate);
@POST("/{api-version}/{message-template-id}")
Call<Template> updateMessageTemplate(@Path("api-version") String apiVersion, @Path("message-template-id") String messageTemplateId, @Body MessageTemplate messageTemplate);

/**
* Delete message template call.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import com.whatsapp.api.impl.WhatsappBusinessManagementApi;

import static com.whatsapp.api.TestConstants.TOKEN;
import static com.whatsapp.api.TestConstants.WABA_ID;

public class UpdateMessageTemplateExample {

Expand All @@ -34,7 +33,7 @@ public static void main(String[] args) {
.addBodyTextExamples("Mr. José", "satisfaction")//
))//
;
whatsappBusinessCloudApi.updateMessageTemplate(WABA_ID, "1144996326396573", template);
whatsappBusinessCloudApi.updateMessageTemplate("1144996326396573", template);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ void testCreateMessageTemplateMarketing2() throws IOException, URISyntaxExceptio
}

/**
* Method under test: {@link WhatsappBusinessManagementApi#updateMessageTemplate(String, String, MessageTemplate)}
* Method under test: {@link WhatsappBusinessManagementApi#updateMessageTemplate(String, MessageTemplate)}
*/
@Test
void testUpdateMessageTemplate() throws IOException, URISyntaxException
Expand All @@ -423,7 +423,7 @@ void testUpdateMessageTemplate() throws IOException, URISyntaxException
.addBodyTextExamples("Mr. José", "satisfaction")//
));

var response = whatsappBusinessCloudApi.updateMessageTemplate(WABA_ID, "952305634123456", template);
var response = whatsappBusinessCloudApi.updateMessageTemplate("952305634123456", template);

Assertions.assertEquals("952305634123456", response.id());
}
Expand Down

0 comments on commit 12920af

Please sign in to comment.