diff --git a/src/contact/functions/getBusinessProfile.ts b/src/contact/functions/getBusinessProfile.ts new file mode 100644 index 0000000000..4aa70a1b85 --- /dev/null +++ b/src/contact/functions/getBusinessProfile.ts @@ -0,0 +1,43 @@ +/*! + * Copyright 2021 WPPConnect Team + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { assertWid } from '../../assert'; +import { + BusinessProfileModel, + BusinessProfileStore, + Wid, +} from '../../whatsapp'; + +/** + * Get the current text status + * + * @example + * ```javascript + * const url = await WPP.contact.getBusinessProfile('[number]@c.us'); + * ``` + * + * @category Contact + */ + +export async function getBusinessProfile( + contactId: string | Wid +): Promise { + const wid = assertWid(contactId); + + const profile = await BusinessProfileStore.fetchBizProfile(wid); + + return profile; +} diff --git a/src/contact/functions/index.ts b/src/contact/functions/index.ts index 958e781789..d4099f2cfd 100644 --- a/src/contact/functions/index.ts +++ b/src/contact/functions/index.ts @@ -15,6 +15,7 @@ */ export { getProfilePictureUrl } from './getProfilePictureUrl'; +export { getBusinessProfile } from './getBusinessProfile'; export { getStatus } from './getStatus'; export { ContactListOptions, list } from './list'; export { queryExists } from './queryExists';