From 40bdd2b3885899bda677bc9f3a117644469975f1 Mon Sep 17 00:00:00 2001 From: nicolau Date: Tue, 25 Jul 2023 22:48:10 -0300 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20update=20identity=20check?= =?UTF-8?q?=20endpoint?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fixed update identity check endpoint passing invalid parameters --- __tests__/client.test.ts | 2 +- src/WABA_client.ts | 5 +++-- src/types/phoneNumbers.ts | 4 ++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/__tests__/client.test.ts b/__tests__/client.test.ts index bdf2d1f..7be3a61 100644 --- a/__tests__/client.test.ts +++ b/__tests__/client.test.ts @@ -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); }); diff --git a/src/WABA_client.ts b/src/WABA_client.ts index f0bcb74..cca24ea 100644 --- a/src/WABA_client.ts +++ b/src/WABA_client.ts @@ -20,6 +20,7 @@ import { UploadMediaResponse, MarkMessageAsReadPayload, BusinessPhoneNumber, + UpdateIdentityCheckState, } from "./types"; import { WABAErrorHandler } from "./utils/errorHandler"; import { createRestClient } from "./utils/restClient"; @@ -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(`${this.phoneId}/settings`, { user_identity_change: { - enable_identity_check: enable, + enable_identity_key_check, }, }); } diff --git a/src/types/phoneNumbers.ts b/src/types/phoneNumbers.ts index e69015b..2facdea 100644 --- a/src/types/phoneNumbers.ts +++ b/src/types/phoneNumbers.ts @@ -16,6 +16,10 @@ export type GetBusinessPhoneNumberResponse = { }; }; +export type UpdateIdentityCheckState = { + enable_identity_key_check: boolean; +}; + export type RequestPhoneNumberVerificationCodePayload = { code_method: "SMS" | "VOICE"; /**