Skip to content

Commit

Permalink
register pin
Browse files Browse the repository at this point in the history
  • Loading branch information
frkr committed Nov 21, 2023
1 parent d98a9dc commit 6ee6f60
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "business-whatsapp",
"author": "frkr",
"license": "MIT",
"version": "18.0.22",
"version": "18.0.23",
"description": "WhatsApp Business API Client unofficial",
"homepage": "https://ideias.casa/",
"repository": {
Expand Down
10 changes: 10 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@ async function defaultFetch(auth: WAAuth, content: object): Promise<Response> {
return fetch(defaultUrlMsg(auth.accid), payload(auth.apikey, content));
}

export async function pinRegister(auth: WAAuth, pin: string): Promise<Response> {
return fetch(
`https://graph.facebook.com/v18.0/${auth.accid}/register`,
payload(auth.apikey, {
'messaging_product': 'whatsapp',
'pin': pin,
}),
);
}

export async function readMessage(auth: WAAuth, msgid: string): Promise<Response> {
let content = {
'messaging_product': 'whatsapp',
Expand Down

0 comments on commit 6ee6f60

Please sign in to comment.