Skip to content

Commit

Permalink
fix: 🐛 update identity check endpoint
Browse files Browse the repository at this point in the history
fixed update identity check endpoint passing invalid parameters
  • Loading branch information
MarcosNicolau committed Jul 26, 2023
1 parent 07680a3 commit 40bdd2b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion __tests__/client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ describe("WABA Cloud API endpoints", () => {
});

it("update identity check state", async () => {
const res = await client.updateIdentityCheckState(true);
const res = await client.updateIdentityCheckState({ enable_identity_key_check: false });
expectDefaultResponse(res);
});

Expand Down
5 changes: 3 additions & 2 deletions src/WABA_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
UploadMediaResponse,
MarkMessageAsReadPayload,
BusinessPhoneNumber,
UpdateIdentityCheckState,
} from "./types";
import { WABAErrorHandler } from "./utils/errorHandler";
import { createRestClient } from "./utils/restClient";
Expand Down Expand Up @@ -190,10 +191,10 @@ export class WABAClient {
* You may want us to verify a customer's identity before we deliver your message to them.
* You can have us do this by enabling the identity change check setting on your business phone number.
*/
async updateIdentityCheckState(enable: boolean) {
async updateIdentityCheckState({ enable_identity_key_check }: UpdateIdentityCheckState) {
return this.restClient.post<DefaultResponse>(`${this.phoneId}/settings`, {
user_identity_change: {
enable_identity_check: enable,
enable_identity_key_check,
},
});
}
Expand Down
4 changes: 4 additions & 0 deletions src/types/phoneNumbers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ export type GetBusinessPhoneNumberResponse = {
};
};

export type UpdateIdentityCheckState = {
enable_identity_key_check: boolean;
};

export type RequestPhoneNumberVerificationCodePayload = {
code_method: "SMS" | "VOICE";
/**
Expand Down

0 comments on commit 40bdd2b

Please sign in to comment.