@apostlejs/whatsapp 0.0.9 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +135 -135
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function e(e){return e&&e.__esModule?e:{default:e}}var t=e(require("node:crypto")),a=Object.defineProperty,r=(e,t)=>{for(var r in t)a(e,r,{get:t[r],enumerable:!0})},n={};r(n,{WhatsappErrorCode:()=>l,endpoints:()=>c,flowsEndpoints:()=>o,messagesEndpoints:()=>i,wabaEndpoints:()=>s});var o={create:{url:"/{waba_id}/flows",method:"post",headers:{"Content-Type":"application/json"},request:{body:null},response:null},updateMetadata:{url:"/{flow_id}",method:"post",headers:{"Content-Type":"application/json"},request:{body:null},response:null},readMany:{url:"/{waba_id}/flows",method:"get",response:null},delete:{url:"/{flow_id}",method:"delete",response:null},read:{url:"/{flow_id}",method:"get",request:{query:null},response:null},updateJson:{url:"/{flow_id}/assets",method:"post",request:{body:null},response:null},getPreview:{url:"/{flow_id}?fields=preview.invalidate(false)",method:"get",response:null},publish:{url:"/{flow_id}/publish",method:"post",response:null}},i={send:{url:"/{number_id}/messages",method:"post",headers:{"Content-Type":"application/json"},request:{body:null},response:null}},s={updateEncryption:{url:"/{number_id}/whatsapp_business_encryption",method:"post",headers:{"Content-Type":"application/x-www-form-urlencoded"},request:{body:null}},registerNumber:{url:"/{number_id}/register",method:"post",headers:{"Content-Type":"application/json"},request:{body:null}}},c={flows:o,messages:i,waba:s},l=(e=>(e[e.e0AuthException=0]="e0AuthException",e[e.e3ApiMethod=3]="e3ApiMethod",e[e.e10PermissionDenied=10]="e10PermissionDenied",e[e.e190AccessTokenExpired=190]="e190AccessTokenExpired",e[e.e2xxApiPermission=200]="e2xxApiPermission",e[e.e368TemporarilyBlockedForPolicyViolations=368]="e368TemporarilyBlockedForPolicyViolations",e[e.e130497BusinessAccountRestrictedByCountry=130497]="e130497BusinessAccountRestrictedByCountry",e[e.e131031AccountLocked=131031]="e131031AccountLocked",e[e.e1ApiUnknown=1]="e1ApiUnknown",e[e.e2ApiService=2]="e2ApiService",e[e.e33ParameterValueNotValid=33]="e33ParameterValueNotValid",e[e.e100InvalidParameter=100]="e100InvalidParameter",e[e.e130472UserNumberPartOfExperiment=130472]="e130472UserNumberPartOfExperiment",e[e.e131000SomethingWentWrong=131e3]="e131000SomethingWentWrong",e[e.e131005AccessDenied=131005]="e131005AccessDenied",e[e.e131008RequiredParameterMissing=131008]="e131008RequiredParameterMissing",e[e.e131009ParameterValueNotValid=131009]="e131009ParameterValueNotValid",e[e.e131016ServiceUnavailable=131016]="e131016ServiceUnavailable",e[e.e131021RecipientCannotBeSender=131021]="e131021RecipientCannotBeSender",e[e.e131026MessageUndeliverable=131026]="e131026MessageUndeliverable",e[e.e131030RecipientNotAllowedInList=131030]="e131030RecipientNotAllowedInList",e[e.e131037DisplayNameApprovalNeeded=131037]="e131037DisplayNameApprovalNeeded",e[e.e131042BusinessEligibilityPaymentIssue=131042]="e131042BusinessEligibilityPaymentIssue",e[e.e131045IncorrectCertificate=131045]="e131045IncorrectCertificate",e[e.e131047ReEngagementMessage=131047]="e131047ReEngagementMessage",e[e.e131049MetaChoseNotToDeliver=131049]="e131049MetaChoseNotToDeliver",e[e.e131050UserStoppedMarketingMessages=131050]="e131050UserStoppedMarketingMessages",e[e.e131051UnsupportedMessageType=131051]="e131051UnsupportedMessageType",e[e.e131052MediaDownloadError=131052]="e131052MediaDownloadError",e[e.e131053MediaUploadError=131053]="e131053MediaUploadError",e[e.e131057AccountInMaintenanceMode=131057]="e131057AccountInMaintenanceMode",e[e.e132000TemplateParamCountMismatch=132e3]="e132000TemplateParamCountMismatch",e[e.e132001TemplateDoesNotExist=132001]="e132001TemplateDoesNotExist",e[e.e132005TemplateHydratedTextTooLong=132005]="e132005TemplateHydratedTextTooLong",e[e.e132007TemplateFormatCharacterPolicyViolated=132007]="e132007TemplateFormatCharacterPolicyViolated",e[e.e132012TemplateParameterFormatMismatch=132012]="e132012TemplateParameterFormatMismatch",e[e.e132015TemplateIsPaused=132015]="e132015TemplateIsPaused",e[e.e132016TemplateIsDisabled=132016]="e132016TemplateIsDisabled",e[e.e132068FlowIsBlocked=132068]="e132068FlowIsBlocked",e[e.e132069FlowIsThrottled=132069]="e132069FlowIsThrottled",e[e.e133000IncompleteDeregistration=133e3]="e133000IncompleteDeregistration",e[e.e133004ServerTemporarilyUnavailable=133004]="e133004ServerTemporarilyUnavailable",e[e.e133005TwoStepVerificationPinMismatch=133005]="e133005TwoStepVerificationPinMismatch",e[e.e133006PhoneNumberReVerificationNeeded=133006]="e133006PhoneNumberReVerificationNeeded",e[e.e133008TooManyTwoStepVerificationPinGuesses=133008]="e133008TooManyTwoStepVerificationPinGuesses",e[e.e133009TwoStepVerificationPinGuessedTooFast=133009]="e133009TwoStepVerificationPinGuessedTooFast",e[e.e133010PhoneNumberNotRegistered=133010]="e133010PhoneNumberNotRegistered",e[e.e133015PhoneNumberDeletionPending=133015]="e133015PhoneNumberDeletionPending",e[e.e134011PaymentsTermsNotAccepted=134011]="e134011PaymentsTermsNotAccepted",e[e.e135000GenericUserError=135e3]="e135000GenericUserError",e[e.e2593107SynchronizationRequestLimitExceeded=2593107]="e2593107SynchronizationRequestLimitExceeded",e[e.e2593108SynchronizationRequestOutsideTimeWindow=2593108]="e2593108SynchronizationRequestOutsideTimeWindow",e[e.e4ApiTooManyCalls=4]="e4ApiTooManyCalls",e[e.e80007RateLimitIssues=80007]="e80007RateLimitIssues",e[e.e130429RateLimitHit=130429]="e130429RateLimitHit",e[e.e131048SpamRateLimitHit=131048]="e131048SpamRateLimitHit",e[e.e131056BusinessConsumerPairRateLimitHit=131056]="e131056BusinessConsumerPairRateLimitHit",e[e.e133016AccountRegisterDeregisterRateLimitExceeded=133016]="e133016AccountRegisterDeregisterRateLimitExceeded",e))(l||{}),d={};r(d,{actions:()=>B,flows:()=>S,parsers:()=>U,security:()=>k,toGraphLanguageTag:()=>N,utils:()=>L});var p={};r(p,{create:()=>h,delete:()=>b,get:()=>v,getMany:()=>P,getPreview:()=>_,publish:()=>E,updateJson:()=>g,updateMetadata:()=>w});var u={};r(u,{settings:()=>m});var f={},m={setup:e=>{Object.assign(f,e)},get:e=>{const t=f[e]??process.env[e];if(!t)throw new Error(`Missing environment variable: ${e}`);return t}};async function y(e,t,a){const r=`https://graph.facebook.com/v${m.get("GRAPH_API_VERSION")}`,n={Authorization:`Bearer ${m.get("META_APP_ACCESS_TOKEN")}`};let o=e.url;const i={...n,...e.headers,...t.headers},s=new URLSearchParams(t.query).toString();"/"===o[0]&&(o=o.slice(1)),o=`${r}/${o}`,s&&(o=`${o}?${s}`);const c={waba_id:m.get("WHATSAPP_ACCOUNT_ID"),number_id:m.get("WHATSAPP_NUMBER_ID"),...t.params};for(const e in c)o=o.replace(`{${e}}`,c[e]);const l=t.body;let d;if(l&&a?.asFormData){const e=new FormData;for(const t in l)e.append(t,l[t]);d=e}else l&&a?.asUrlEncoded?d=new URLSearchParams(l).toString():l&&(d=JSON.stringify(l));return await fetch(o,{method:e.method,headers:i,body:d}).then((e=>e.json())).then((e=>{if("error"in e)throw{response:{data:e.error}};return e})).catch((async e=>{const t=e.response.data.message,a=e.response.data.error_data?.details||"",r=t.match(/^\(#\d+\)/),n=r?r[0]:"",o=t.replace(/^\(#\d+\)\s*/,""),i=a?a.startsWith(o)?`${n} ${a}`:`${t}: ${a}`:t;e.response.data.message=i;const{message:s,...c}=e.response.data;throw new Error(s,{cause:c})}))}async function h(e){const t=c.flows.create,a=e.flow_json?JSON.stringify(e.flow_json,null,2):void 0;return await y(t,{body:{name:e.name,categories:e.categories,clone_flow_id:e.clone_flow_id,endpoint_uri:e.endpoint_uri,publish:e.publish,flow_json:a}})}async function w(e,t){const a=c.flows.updateMetadata;return await y(a,{body:t,params:{flow_id:e}})}async function g(e,t){const a=c.flows.updateJson,r={name:"flow.json",asset_type:"FLOW_JSON",file:new Blob([JSON.stringify(t,null,2)],{type:"application/json"})};return await y(a,{params:{flow_id:e},body:r},{asFormData:!0}).catch((e=>{if(e.error_user_msg.startsWith("Flow JSON has been saved"))return{success:!0,validation_errors:[]};throw e}))}async function _(e,t){const a=c.flows.getPreview,{preview:r}=await y(a,{params:{flow_id:e}}),n=r.preview_url.replaceAll("\\",""),o=Object.entries(t??{}).reduce(((e,[t,a])=>(e[t]="flow_action_payload"===t?encodeURIComponent(JSON.stringify(a)):a.toString(),e)),{});return`${n}&${new URLSearchParams(o).toString()}`}async function b(e){const t=c.flows.delete;return await y(t,{params:{flow_id:e}})}async function v(e,t){const a=c.flows.read;return await y(a,{params:{flow_id:e},query:{fields:t?.fields.join(",")??""}})}async function P(){const e=c.flows.readMany;return await y(e,{})}async function E(e){const t=c.flows.publish;return await y(t,{params:{flow_id:e}})}var T=e=>e.split("?")[0],S={createToken:({flow_name:e,flow_parameters:t,chatId:a})=>{const r=new URLSearchParams({chat_id:a});if(r.set("flow_identifier",crypto.randomUUID()),t)for(const[e,a]of Object.entries(t))r.set(e,a.toString());return`${e}?${decodeURIComponent(r.toString())}`},getName:T,destructureFlowToken:e=>{const t=T(e);let a=e.split("?")?.[1];"&"===a?.[0]&&(a=a.slice(1));const r=new URLSearchParams(a),n=r.get("chat_id")||r.get("chatId"),o=r.get("flow_identifier")||r.get("flowIdentifier"),i={};for(const[e,t]of r.entries())"chat_id"!==e&&"chatId"!==e&&"flow_identifier"!==e&&"flowIdentifier"!==e&&(i[e]=t);return{paramsString:a,flowName:t,chatId:n,flowIdentifier:o,flowParameters:i}}},A={"ar-SA":"ar","bn-BD":"bn","bn-IN":"bn","cs-CZ":"cs","da-DK":"da","de-AT":"de","de-CH":"de","de-DE":"de","el-GR":"el","en-AU":"en","en-CA":"en","en-GB":"en_GB","en-IE":"en","en-IN":"en","en-NZ":"en","en-ZA":"en","en-US":"en_US","es-AR":"es_AR","es-CL":"es","es-CO":"es","es-ES":"es_ES","es-MX":"es_MX","es-US":"es","fi-FI":"fi","fr-BE":"fr","fr-CA":"fr","fr-CH":"fr","fr-FR":"fr","he-IL":"he","hi-IN":"hi","hu-HU":"hu","id-ID":"id","it-CH":"it","it-IT":"it","ja-JP":"ja","ko-KR":"ko","nl-BE":"nl","nl-NL":"nl","no-NO":"nb","pl-PL":"pl","pt-PT":"pt_PT","pt-BR":"pt_BR","ro-RO":"ro","ru-RU":"ru","sk-SK":"sk","sv-SE":"sv","ta-IN":"ta","ta-LK":"ta","th-TH":"th","tr-TR":"tr","zh-CN":"zh_CN","zh-HK":"zh_HK","zh-TW":"zh_TW"},N=e=>{const t=A[e];return void 0===t?"en":t},I=e=>{const t={to:e.to,messaging_product:"whatsapp",recipient_type:"individual"};return e.reply&&(t.context={message_id:e.reply}),e.showUrlPreviewImage&&(t.preview_url=e.showUrlPreviewImage),t},R={flow:e=>{if("flow"!==e.message.type)throw new Error("Invalid type");const{message:t,...a}=e,{flow:r,...n}=t,o=I(a);r.mode||(r.mode=m.get("WHATSAPP_FLOWS_MODE"));const i=S.createToken({chatId:o.to,flow_name:r.name,flow_parameters:r.parameters});return{type:"interactive",...o,interactive:{...n,type:"flow",action:{name:"flow",parameters:{flow_name:r.name,flow_token:i,flow_message_version:"3",flow_cta:r.button,flow_action:r.action??"navigate",mode:r.mode,...r.payload&&{flow_action_payload:{...r.payload,screen:r.payload.screen.toUpperCase()}}}}}}},text:e=>{if("text"!==e.message.type)throw new Error("Invalid type");const{message:{text:t},...a}=e,r={type:"text",text:{body:t},...I(a)};return e.message.previewUrl&&r.text&&(r.text.preview_url=e.message.previewUrl),r},list:e=>{if("list"!==e.message.type)throw new Error("Invalid type");const{message:t,...a}=e,{list:r,type:n,...o}=t;return{...I(a),type:"interactive",interactive:{...o,type:n,action:r}}},button:e=>{if("button"!==e.message.type)throw new Error("Invalid type");const{message:t,...a}=e,{buttons:r,type:n,...o}=t;return{...I(a),type:"interactive",interactive:{...o,type:n,action:{buttons:r.map((e=>({reply:{id:e.id,title:e.text},type:"reply"})))}}}},template:e=>{if("template"!==e.message.type)throw new Error("Invalid type");const{message:{type:t,...a},...r}=e,n={...I(r),type:t,template:{...a,language:{code:N(a.language)}}};return n.template&&(n.template.namespace=process.env.WHATSAPP_MESSAGE_NAMESPACE),n},media:e=>{if("media"!==e.message.type)throw new Error("Invalid type");const{message:{type:t,...a},...r}=e,n=Object.entries(a)[0],[o,{ref:i,...s}]=n,c=s,l=I(r);return Number.isNaN(Number(i))?c.link=i:c.id=i,{type:o,[o]:c,...l}},contact:e=>{if("contact"!==e.message.type)throw new Error("Invalid type");const{message:{contacts:t},...a}=e;return{type:"contacts",contacts:t,...I(a)}}};function M(e){const{encrypted_aes_key:a,encrypted_flow_data:r,initial_vector:n}=e,o=t.default.createPrivateKey({key:m.get("WHATSAPP_ACCOUNT_ENCRYPTION_PRIVATE_KEY"),passphrase:m.get("WHATSAPP_ACCOUNT_ENCRYPTION_PASSPHRASE")}),i=t.default.privateDecrypt({key:o,padding:t.default.constants.RSA_PKCS1_OAEP_PADDING,oaepHash:"sha256"},Buffer.from(a,"base64")),s=Buffer.from(r,"base64"),c=Buffer.from(n,"base64"),l=s.subarray(0,-16),d=s.subarray(-16),p=t.default.createDecipheriv("aes-128-gcm",i,c);p.setAuthTag(d);const u=Buffer.concat([p.update(l),p.final()]).toString("utf-8");return{payload:JSON.parse(u),encryptionMetadata:{aesKeyBuffer:i,initialVectorBuffer:c}}}function C(e){const t=new URL(e.url).searchParams,a=t.get("hub.verify_token"),r=t.get("hub.challenge");return!(!a||!r)&&a===m.get("WHATSAPP_WEBHOOK_KEY")&&r}async function x(e,a){const r=e.headers.get("x-hub-signature-256");if(!r)return!1;const n=r.replace("sha256=",""),o=t.default.createHmac("sha256",m.get("WHATSAPP_WEBHOOK_KEY")).update(a,"utf-8").digest("hex");return!!t.default.timingSafeEqual(Buffer.from(n),Buffer.from(o))}var U={toGraph:{sendMessage:e=>R[e.message.type](e),flowResponse:(e,t)=>{if(!t.data)throw new Error("Missing data in flow response");if(!t.screen)throw new Error("Missing screen in flow response");if(t.screen=t.screen.toUpperCase(),"SUCCESS"===t.screen){const a=t.data??{};t.data={extension_message_response:{params:{flow_token:e,...a}}}}return t}},toSDK:{webhook:async function(e){if("GET"===e.method){const t=C(e);if(!t)throw new Error("Invalid health check hub");return{type:"healthCheck",payload:t}}const t=await e.text(),a=JSON.parse(t);if("entry"in a){if(!x(e,t))throw new Error("Invalid application webhook signature");const n=a.entry.flatMap((e=>e.changes)).filter((e=>"messages"===e.field)).flatMap((e=>e.value.messages)).filter(Boolean).map((e=>function(e){const t=e.from,a={id:e.id,type:e.type,timestamp:e.timestamp,metadata:{forwarded:e.context?.forwarded,frequentlyForwarded:e.context?.frequently_forwarded}},r=function(e){if(!(e.audio||e.document||e.video||e.image))return null;const t=e.audio?.id??e.document?.id??e.image?.id??e.video?.id,a=e.audio?.mime_type??e.document?.mime_type??e.image?.mime_type??e.video?.mime_type,r=["audio","document","image","video"].find((t=>e[t])),n=e.image?.sha256??e.document?.sha256??e.video?.sha256;return{id:t,type:r,caption:e.document?.caption??e.image?.caption??e.video?.caption??null,mime_type:a,sha256:n,filename:e.document?.filename??e.video?.filename}}(e),n=function(e){return e.text?.body??e.button?.text??e.interactive?.button_reply?.title??e.interactive?.list_reply?.title??e.document?.caption??null}(e),o=function(e){return e.interactive?{...e.interactive?.button_reply||e.button?{button:{id:e.interactive?.button_reply?.id??null,title:e.button?.text??e.interactive.button_reply?.title,payload:e.button?.payload??null}}:{},...e.interactive.list_reply?{selectedOption:{id:e.interactive.list_reply.id,title:e.interactive.list_reply.title,description:e.interactive.list_reply.description}}:{},...e.interactive.nfm_reply?{flowResponse:JSON.parse(e.interactive.nfm_reply.response_json)}:{}}:null}(e);return{...a,...o&&{interaction:o},...r&&{media:r},text:n,chatId:t}}(e)));return{type:"application",payload:{messageReceived:(r=n,r.length?r:void 0)}}}var r;if("encrypted_flow_data"in a)return{type:"flowExchange",payload:{...M(a),pingResponse:{data:{status:"active"}}}};throw new Error("Unrecognized event")}}},B={messages:{send:async function(e){const t=U.toGraph.sendMessage(e),a=c.messages.send;return await y(a,{body:t})}},flows:{...p},waba:{registerNumber:async function({dataRegion:e,pin:t}){const a=c.waba.registerNumber,r={messaging_product:"whatsapp",pin:t};return e&&(r.data_localization_region=e),await y(a,{body:r},{asUrlEncoded:!0})},encryption:{upload:async function(e){const t=c.waba.updateEncryption,a={business_public_key:e};return await y(t,{body:a},{asUrlEncoded:!0})}}}};async function D(e){return await fetch(e).then((async e=>{const t=await e.arrayBuffer();return Buffer.from(t)}))}var k={verifyHub:C,verifySignature:x,generateWabaEncryption:async function(){const e=t.default.randomUUID(),{publicKey:a,privateKey:r}=t.default.generateKeyPairSync("rsa",{modulusLength:2048,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem",cipher:"aes-256-cbc",passphrase:e}});return{passphrase:e,publicKey:a,privateKey:r}},decryptFlowBody:M,encryptFlowResponse:function(e,a){const r=[];for(const e of Buffer.from(a.initialVectorBuffer).entries())r.push(~e[1]);const n=t.default.createCipheriv("aes-128-gcm",Buffer.from(a.aesKeyBuffer),Buffer.from(r));return Buffer.concat([n.update(JSON.stringify(e),"utf-8"),n.final(),n.getAuthTag()]).toString("base64")},decryptFlowMedia:async function(e){const a=[];for(const r of e){let{cdn_url:e,encryption_metadata:n}=r;if("EXAMPLE_DATA__CDN_URL_WILL_COME_IN_THIS_FIELD"===e){e="https://picsum.photos/seed/picsum/200";const t=await D(e);a.push(t);continue}const o=await D(e),{iv:i,encryption_key:s,hmac_key:c,encrypted_hash:l,plaintext_hash:d}=n,p={iv:Buffer.from(i,"base64"),encryption_key:Buffer.from(s,"base64"),hmac_key:Buffer.from(c,"base64")};if(t.default.createHash("sha256").update(o).digest("base64")!==l)throw new Error("Encrypted hash validation failed");const u=o.subarray(0,o.length-10),f=o.subarray(-10);if(!t.default.createHmac("sha256",p.hmac_key).update(Buffer.concat([p.iv,u])).digest().subarray(0,10).equals(f))throw new Error("HMAC validation failed");const m=t.default.createDecipheriv("aes-256-cbc",p.encryption_key,p.iv),y=m.update(u),h=Buffer.concat([y,m.final()]);if(t.default.createHash("sha256").update(h).digest("base64")!==d)throw new Error("Decrypted media hash validation failed");a.push(h)}return a}},L={flows:S},O=null;exports.WhatsappErrorCode=l,exports.actions=B,exports.createWhatsapp=()=>O||(O=(()=>{const{settings:e}=u,{actions:t,flows:a,parsers:r,security:o,utils:i,toGraphLanguageTag:s}=d,{endpoints:c}=n;return{settings:e,sdk:{actions:t,flows:a,parsers:r,security:o,utils:i,toGraphLanguageTag:s},graph:{endpoints:c}}})()),exports.endpoints=c,exports.flows=S,exports.flowsEndpoints=o,exports.messagesEndpoints=i,exports.parsers=U,exports.security=k,exports.toGraphLanguageTag=N,exports.utils=L,exports.wabaEndpoints=s;
|
|
1
|
+
"use strict";function e(e){return e&&e.__esModule?e:{default:e}}var t=e(require("node:crypto")),a=Object.defineProperty,n=(e,t)=>{for(var n in t)a(e,n,{get:t[n],enumerable:!0})},r={};n(r,{WhatsappErrorCode:()=>l,endpoints:()=>c,flowsEndpoints:()=>o,messagesEndpoints:()=>s,wabaEndpoints:()=>i});var o={create:{url:"/{waba_id}/flows",method:"post",headers:{"Content-Type":"application/json"},request:{body:null},response:null},updateMetadata:{url:"/{flow_id}",method:"post",headers:{"Content-Type":"application/json"},request:{body:null},response:null},readMany:{url:"/{waba_id}/flows",method:"get",response:null},delete:{url:"/{flow_id}",method:"delete",response:null},read:{url:"/{flow_id}",method:"get",request:{query:null},response:null},updateJson:{url:"/{flow_id}/assets",method:"post",request:{body:null},response:null},getPreview:{url:"/{flow_id}?fields=preview.invalidate(false)",method:"get",response:null},publish:{url:"/{flow_id}/publish",method:"post",response:null}},s={send:{url:"/{number_id}/messages",method:"post",headers:{"Content-Type":"application/json"},request:{body:null},response:null}},i={updateEncryption:{url:"/{number_id}/whatsapp_business_encryption",method:"post",headers:{"Content-Type":"application/x-www-form-urlencoded"},request:{body:null}},registerNumber:{url:"/{number_id}/register",method:"post",headers:{"Content-Type":"application/json"},request:{body:null}}},c={flows:o,messages:s,waba:i},l=(e=>(e[e.e0AuthException=0]="e0AuthException",e[e.e3ApiMethod=3]="e3ApiMethod",e[e.e10PermissionDenied=10]="e10PermissionDenied",e[e.e190AccessTokenExpired=190]="e190AccessTokenExpired",e[e.e2xxApiPermission=200]="e2xxApiPermission",e[e.e368TemporarilyBlockedForPolicyViolations=368]="e368TemporarilyBlockedForPolicyViolations",e[e.e130497BusinessAccountRestrictedByCountry=130497]="e130497BusinessAccountRestrictedByCountry",e[e.e131031AccountLocked=131031]="e131031AccountLocked",e[e.e1ApiUnknown=1]="e1ApiUnknown",e[e.e2ApiService=2]="e2ApiService",e[e.e33ParameterValueNotValid=33]="e33ParameterValueNotValid",e[e.e100InvalidParameter=100]="e100InvalidParameter",e[e.e130472UserNumberPartOfExperiment=130472]="e130472UserNumberPartOfExperiment",e[e.e131000SomethingWentWrong=131e3]="e131000SomethingWentWrong",e[e.e131005AccessDenied=131005]="e131005AccessDenied",e[e.e131008RequiredParameterMissing=131008]="e131008RequiredParameterMissing",e[e.e131009ParameterValueNotValid=131009]="e131009ParameterValueNotValid",e[e.e131016ServiceUnavailable=131016]="e131016ServiceUnavailable",e[e.e131021RecipientCannotBeSender=131021]="e131021RecipientCannotBeSender",e[e.e131026MessageUndeliverable=131026]="e131026MessageUndeliverable",e[e.e131030RecipientNotAllowedInList=131030]="e131030RecipientNotAllowedInList",e[e.e131037DisplayNameApprovalNeeded=131037]="e131037DisplayNameApprovalNeeded",e[e.e131042BusinessEligibilityPaymentIssue=131042]="e131042BusinessEligibilityPaymentIssue",e[e.e131045IncorrectCertificate=131045]="e131045IncorrectCertificate",e[e.e131047ReEngagementMessage=131047]="e131047ReEngagementMessage",e[e.e131049MetaChoseNotToDeliver=131049]="e131049MetaChoseNotToDeliver",e[e.e131050UserStoppedMarketingMessages=131050]="e131050UserStoppedMarketingMessages",e[e.e131051UnsupportedMessageType=131051]="e131051UnsupportedMessageType",e[e.e131052MediaDownloadError=131052]="e131052MediaDownloadError",e[e.e131053MediaUploadError=131053]="e131053MediaUploadError",e[e.e131057AccountInMaintenanceMode=131057]="e131057AccountInMaintenanceMode",e[e.e132000TemplateParamCountMismatch=132e3]="e132000TemplateParamCountMismatch",e[e.e132001TemplateDoesNotExist=132001]="e132001TemplateDoesNotExist",e[e.e132005TemplateHydratedTextTooLong=132005]="e132005TemplateHydratedTextTooLong",e[e.e132007TemplateFormatCharacterPolicyViolated=132007]="e132007TemplateFormatCharacterPolicyViolated",e[e.e132012TemplateParameterFormatMismatch=132012]="e132012TemplateParameterFormatMismatch",e[e.e132015TemplateIsPaused=132015]="e132015TemplateIsPaused",e[e.e132016TemplateIsDisabled=132016]="e132016TemplateIsDisabled",e[e.e132068FlowIsBlocked=132068]="e132068FlowIsBlocked",e[e.e132069FlowIsThrottled=132069]="e132069FlowIsThrottled",e[e.e133000IncompleteDeregistration=133e3]="e133000IncompleteDeregistration",e[e.e133004ServerTemporarilyUnavailable=133004]="e133004ServerTemporarilyUnavailable",e[e.e133005TwoStepVerificationPinMismatch=133005]="e133005TwoStepVerificationPinMismatch",e[e.e133006PhoneNumberReVerificationNeeded=133006]="e133006PhoneNumberReVerificationNeeded",e[e.e133008TooManyTwoStepVerificationPinGuesses=133008]="e133008TooManyTwoStepVerificationPinGuesses",e[e.e133009TwoStepVerificationPinGuessedTooFast=133009]="e133009TwoStepVerificationPinGuessedTooFast",e[e.e133010PhoneNumberNotRegistered=133010]="e133010PhoneNumberNotRegistered",e[e.e133015PhoneNumberDeletionPending=133015]="e133015PhoneNumberDeletionPending",e[e.e134011PaymentsTermsNotAccepted=134011]="e134011PaymentsTermsNotAccepted",e[e.e135000GenericUserError=135e3]="e135000GenericUserError",e[e.e2593107SynchronizationRequestLimitExceeded=2593107]="e2593107SynchronizationRequestLimitExceeded",e[e.e2593108SynchronizationRequestOutsideTimeWindow=2593108]="e2593108SynchronizationRequestOutsideTimeWindow",e[e.e4ApiTooManyCalls=4]="e4ApiTooManyCalls",e[e.e80007RateLimitIssues=80007]="e80007RateLimitIssues",e[e.e130429RateLimitHit=130429]="e130429RateLimitHit",e[e.e131048SpamRateLimitHit=131048]="e131048SpamRateLimitHit",e[e.e131056BusinessConsumerPairRateLimitHit=131056]="e131056BusinessConsumerPairRateLimitHit",e[e.e133016AccountRegisterDeregisterRateLimitExceeded=133016]="e133016AccountRegisterDeregisterRateLimitExceeded",e))(l||{}),d={};n(d,{actions:()=>D,flows:()=>P,parsers:()=>L,security:()=>x,toGraphLanguageTag:()=>I,utils:()=>O});var p={};n(p,{create:()=>_,delete:()=>E,get:()=>b,getMany:()=>v,getPreview:()=>g,publish:()=>T,updateJson:()=>w,updateMetadata:()=>h});var u={};n(u,{settings:()=>m});var f={},m={setup:e=>{Object.assign(f,e)},get:e=>{const t=f[e]??process.env[e];if(!t)throw new Error(`Missing environment variable: ${e}`);return t}};async function y(e,t,a){const n=`https://graph.facebook.com/v${m.get("GRAPH_API_VERSION")}`,r={Authorization:`Bearer ${m.get("META_APP_ACCESS_TOKEN")}`};let o=e.url;const s={...r,...e.headers,...t.headers},i=new URLSearchParams(t.query).toString();"/"===o[0]&&(o=o.slice(1)),o=`${n}/${o}`,i&&(o=`${o}?${i}`);const c={waba_id:m.get("WHATSAPP_ACCOUNT_ID"),number_id:m.get("WHATSAPP_NUMBER_ID"),...t.params};for(const e in c)o=o.replace(`{${e}}`,c[e]);const l=t.body;let d;if(l&&a?.asFormData){const e=new FormData;for(const t in l)e.append(t,l[t]);d=e}else l&&a?.asUrlEncoded?d=new URLSearchParams(l).toString():l&&(d=JSON.stringify(l));return await fetch(o,{method:e.method,headers:s,body:d}).then((e=>e.json())).then((e=>{if("error"in e)throw{response:{data:e.error}};return e})).catch((async e=>{const t=e.response.data.message,a=e.response.data.error_data?.details||"",n=t.match(/^\(#\d+\)/),r=n?n[0]:"",o=t.replace(/^\(#\d+\)\s*/,""),s=a?a.startsWith(o)?`${r} ${a}`:`${t}: ${a}`:t;e.response.data.message=s;const{message:i,...c}=e.response.data;throw new Error(i,{cause:c})}))}async function _(e){const t=c.flows.create,a=e.flow_json?JSON.stringify(e.flow_json,null,2):void 0;return await y(t,{body:{name:e.name,categories:e.categories,clone_flow_id:e.clone_flow_id,endpoint_uri:e.endpoint_uri,publish:e.publish,flow_json:a}})}async function h(e,t){const a=c.flows.updateMetadata;return await y(a,{body:t,params:{flow_id:e}})}async function w(e,t){const a=c.flows.updateJson,n={name:"flow.json",asset_type:"FLOW_JSON",file:new Blob([JSON.stringify(t,null,2)],{type:"application/json"})};return await y(a,{params:{flow_id:e},body:n},{asFormData:!0}).catch((e=>{if(e.error_user_msg.startsWith("Flow JSON has been saved"))return{success:!0,validation_errors:[]};throw e}))}async function g(e,t){const a=c.flows.getPreview,{preview:n}=await y(a,{params:{flow_id:e}}),r=n.preview_url.replaceAll("\\",""),o=Object.entries(t??{}).reduce(((e,[t,a])=>(e[t]="flow_action_payload"===t?encodeURIComponent(JSON.stringify(a)):a.toString(),e)),{});return`${r}&${new URLSearchParams(o).toString()}`}async function E(e){const t=c.flows.delete;return await y(t,{params:{flow_id:e}})}async function b(e,t){const a=c.flows.read;return await y(a,{params:{flow_id:e},query:{fields:t?.fields.join(",")??""}})}async function v(){const e=c.flows.readMany;return await y(e,{})}async function T(e){const t=c.flows.publish;return await y(t,{params:{flow_id:e}})}var S=e=>e.split("?")[0],P={createToken:({flow_name:e,flow_parameters:t,chatId:a})=>{const n=new URLSearchParams({chat_id:a});if(n.set("flow_identifier",crypto.randomUUID()),t)for(const[e,a]of Object.entries(t))n.set(e,a.toString());return`${e}?${decodeURIComponent(n.toString())}`},getName:S,destructureFlowToken:e=>{const t=S(e);let a=e.split("?")?.[1];"&"===a?.[0]&&(a=a.slice(1));const n=new URLSearchParams(a),r=n.get("chat_id")||n.get("chatId"),o=n.get("flow_identifier")||n.get("flowIdentifier"),s={};for(const[e,t]of n.entries())"chat_id"!==e&&"chatId"!==e&&"flow_identifier"!==e&&"flowIdentifier"!==e&&(s[e]=t);return{paramsString:a,flowName:t,chatId:r,flowIdentifier:o,flowParameters:s}}},N=(e=>(e.AR_SA="ar-SA",e.BN_BD="bn-BD",e.BN_IN="bn-IN",e.CS_CZ="cs-CZ",e.DA_DK="da-DK",e.DE_AT="de-AT",e.DE_CH="de-CH",e.DE_DE="de-DE",e.EL_GR="el-GR",e.EN_AU="en-AU",e.EN_CA="en-CA",e.EN_GB="en-GB",e.EN_IE="en-IE",e.EN_IN="en-IN",e.EN_NZ="en-NZ",e.EN_US="en-US",e.EN_ZA="en-ZA",e.ES_AR="es-AR",e.ES_CL="es-CL",e.ES_CO="es-CO",e.ES_ES="es-ES",e.ES_MX="es-MX",e.ES_US="es-US",e.FI_FI="fi-FI",e.FR_BE="fr-BE",e.FR_CA="fr-CA",e.FR_CH="fr-CH",e.FR_FR="fr-FR",e.HE_IL="he-IL",e.HI_IN="hi-IN",e.HU_HU="hu-HU",e.ID_ID="id-ID",e.IT_CH="it-CH",e.IT_IT="it-IT",e.JA_JP="ja-JP",e.KO_KR="ko-KR",e.NL_BE="nl-BE",e.NL_NL="nl-NL",e.NO_NO="no-NO",e.PL_PL="pl-PL",e.PT_BR="pt-BR",e.PT_PT="pt-PT",e.RO_RO="ro-RO",e.RU_RU="ru-RU",e.SK_SK="sk-SK",e.SV_SE="sv-SE",e.TA_IN="ta-IN",e.TA_LK="ta-LK",e.TH_TH="th-TH",e.TR_TR="tr-TR",e.ZH_CN="zh-CN",e.ZH_HK="zh-HK",e.ZH_TW="zh-TW",e))(N||{}),A={"ar-SA":"ar","bn-BD":"bn","bn-IN":"bn","cs-CZ":"cs","da-DK":"da","de-AT":"de","de-CH":"de","de-DE":"de","el-GR":"el","en-AU":"en","en-CA":"en","en-GB":"en_GB","en-IE":"en","en-IN":"en","en-NZ":"en","en-ZA":"en","en-US":"en_US","es-AR":"es_AR","es-CL":"es","es-CO":"es","es-ES":"es_ES","es-MX":"es_MX","es-US":"es","fi-FI":"fi","fr-BE":"fr","fr-CA":"fr","fr-CH":"fr","fr-FR":"fr","he-IL":"he","hi-IN":"hi","hu-HU":"hu","id-ID":"id","it-CH":"it","it-IT":"it","ja-JP":"ja","ko-KR":"ko","nl-BE":"nl","nl-NL":"nl","no-NO":"nb","pl-PL":"pl","pt-PT":"pt_PT","pt-BR":"pt_BR","ro-RO":"ro","ru-RU":"ru","sk-SK":"sk","sv-SE":"sv","ta-IN":"ta","ta-LK":"ta","th-TH":"th","tr-TR":"tr","zh-CN":"zh_CN","zh-HK":"zh_HK","zh-TW":"zh_TW"},I=e=>{const t=A[e];return void 0===t?"en":t},R=e=>{const t={to:e.to,messaging_product:"whatsapp",recipient_type:"individual"};return e.reply&&(t.context={message_id:e.reply}),e.showUrlPreviewImage&&(t.preview_url=e.showUrlPreviewImage),t},C={flow:e=>{if("flow"!==e.message.type)throw new Error("Invalid type");const{message:t,...a}=e,{flow:n,...r}=t,o=R(a);n.mode||(n.mode=m.get("WHATSAPP_FLOWS_MODE"));const s=P.createToken({chatId:o.to,flow_name:n.name,flow_parameters:n.parameters});return{type:"interactive",...o,interactive:{...r,type:"flow",action:{name:"flow",parameters:{flow_name:n.name,flow_token:s,flow_message_version:"3",flow_cta:n.button,flow_action:n.action??"navigate",mode:n.mode,...n.payload&&{flow_action_payload:{...n.payload,screen:n.payload.screen.toUpperCase()}}}}}}},text:e=>{if("text"!==e.message.type)throw new Error("Invalid type");const{message:{text:t},...a}=e,n={type:"text",text:{body:t},...R(a)};return e.message.previewUrl&&n.text&&(n.text.preview_url=e.message.previewUrl),n},list:e=>{if("list"!==e.message.type)throw new Error("Invalid type");const{message:t,...a}=e,{list:n,type:r,...o}=t;return{...R(a),type:"interactive",interactive:{...o,type:r,action:n}}},button:e=>{if("button"!==e.message.type)throw new Error("Invalid type");const{message:t,...a}=e,{buttons:n,type:r,...o}=t;return{...R(a),type:"interactive",interactive:{...o,type:r,action:{buttons:n.map((e=>({reply:{id:e.id,title:e.text},type:"reply"})))}}}},template:e=>{if("template"!==e.message.type)throw new Error("Invalid type");const{message:{type:t,...a},...n}=e,r={...R(n),type:t,template:{...a,language:{code:I(a.language)}}};return r.template&&(r.template.namespace=process.env.WHATSAPP_MESSAGE_NAMESPACE),r},media:e=>{if("media"!==e.message.type)throw new Error("Invalid type");const{message:{type:t,...a},...n}=e,r=Object.entries(a)[0],[o,{ref:s,...i}]=r,c=i,l=R(n);return Number.isNaN(Number(s))?c.link=s:c.id=s,{type:o,[o]:c,...l}},contact:e=>{if("contact"!==e.message.type)throw new Error("Invalid type");const{message:{contacts:t},...a}=e;return{type:"contacts",contacts:t,...R(a)}}};function U(e){const{encrypted_aes_key:a,encrypted_flow_data:n,initial_vector:r}=e,o=t.default.createPrivateKey({key:m.get("WHATSAPP_ACCOUNT_ENCRYPTION_PRIVATE_KEY"),passphrase:m.get("WHATSAPP_ACCOUNT_ENCRYPTION_PASSPHRASE")}),s=t.default.privateDecrypt({key:o,padding:t.default.constants.RSA_PKCS1_OAEP_PADDING,oaepHash:"sha256"},Buffer.from(a,"base64")),i=Buffer.from(n,"base64"),c=Buffer.from(r,"base64"),l=i.subarray(0,-16),d=i.subarray(-16),p=t.default.createDecipheriv("aes-128-gcm",s,c);p.setAuthTag(d);const u=Buffer.concat([p.update(l),p.final()]).toString("utf-8");return{payload:JSON.parse(u),encryptionMetadata:{aesKeyBuffer:s,initialVectorBuffer:c}}}function B(e){const t=new URL(e.url).searchParams,a=t.get("hub.verify_token"),n=t.get("hub.challenge");return!(!a||!n)&&a===m.get("WHATSAPP_WEBHOOK_KEY")&&n}async function M(e,a){const n=e.headers.get("x-hub-signature-256");if(!n)return!1;const r=n.replace("sha256=",""),o=t.default.createHmac("sha256",m.get("WHATSAPP_WEBHOOK_KEY")).update(a,"utf-8").digest("hex");return!!t.default.timingSafeEqual(Buffer.from(r),Buffer.from(o))}var L={toGraph:{sendMessage:e=>C[e.message.type](e),flowResponse:(e,t)=>{if(!t.data)throw new Error("Missing data in flow response");if(!t.screen)throw new Error("Missing screen in flow response");if(t.screen=t.screen.toUpperCase(),"SUCCESS"===t.screen){const a=t.data??{};t.data={extension_message_response:{params:{flow_token:e,...a}}}}return t}},toSDK:{webhook:async function(e){if("GET"===e.method){const t=B(e);if(!t)throw new Error("Invalid health check hub");return{type:"healthCheck",payload:t}}const t=await e.text(),a=JSON.parse(t);if("entry"in a){if(!M(e,t))throw new Error("Invalid application webhook signature");const r=a.entry.flatMap((e=>e.changes)).filter((e=>"messages"===e.field)).flatMap((e=>e.value.messages)).filter(Boolean).map((e=>function(e){const t=e.from,a={id:e.id,type:e.type,timestamp:e.timestamp,metadata:{forwarded:e.context?.forwarded,frequentlyForwarded:e.context?.frequently_forwarded}},n=function(e){if(!(e.audio||e.document||e.video||e.image))return null;const t=e.audio?.id??e.document?.id??e.image?.id??e.video?.id,a=e.audio?.mime_type??e.document?.mime_type??e.image?.mime_type??e.video?.mime_type,n=["audio","document","image","video"].find((t=>e[t])),r=e.image?.sha256??e.document?.sha256??e.video?.sha256;return{id:t,type:n,caption:e.document?.caption??e.image?.caption??e.video?.caption??null,mime_type:a,sha256:r,filename:e.document?.filename??e.video?.filename}}(e),r=function(e){return e.text?.body??e.button?.text??e.interactive?.button_reply?.title??e.interactive?.list_reply?.title??e.document?.caption??null}(e),o=function(e){return e.interactive?{...e.interactive?.button_reply||e.button?{button:{id:e.interactive?.button_reply?.id??null,title:e.button?.text??e.interactive.button_reply?.title,payload:e.button?.payload??null}}:{},...e.interactive.list_reply?{selectedOption:{id:e.interactive.list_reply.id,title:e.interactive.list_reply.title,description:e.interactive.list_reply.description}}:{},...e.interactive.nfm_reply?{flowResponse:JSON.parse(e.interactive.nfm_reply.response_json)}:{}}:null}(e);return{...a,...o&&{interaction:o},...n&&{media:n},text:r,chatId:t}}(e)));return{type:"application",payload:{messageReceived:(n=r,n.length?n:void 0)}}}var n;if("encrypted_flow_data"in a)return{type:"flowExchange",payload:{...U(a),pingResponse:{data:{status:"active"}}}};throw new Error("Unrecognized event")}}},D={messages:{send:async function(e){const t=L.toGraph.sendMessage(e),a=c.messages.send;return await y(a,{body:t})}},flows:{...p},waba:{registerNumber:async function({dataRegion:e,pin:t}){const a=c.waba.registerNumber,n={messaging_product:"whatsapp",pin:t};return e&&(n.data_localization_region=e),await y(a,{body:n},{asUrlEncoded:!0})},encryption:{upload:async function(e){const t=c.waba.updateEncryption,a={business_public_key:e};return await y(t,{body:a},{asUrlEncoded:!0})}}}};async function H(e){return await fetch(e).then((async e=>{const t=await e.arrayBuffer();return Buffer.from(t)}))}var x={verifyHub:B,verifySignature:M,generateWabaEncryption:async function(){const e=t.default.randomUUID(),{publicKey:a,privateKey:n}=t.default.generateKeyPairSync("rsa",{modulusLength:2048,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem",cipher:"aes-256-cbc",passphrase:e}});return{passphrase:e,publicKey:a,privateKey:n}},decryptFlowBody:U,encryptFlowResponse:function(e,a){const n=[];for(const e of Buffer.from(a.initialVectorBuffer).entries())n.push(~e[1]);const r=t.default.createCipheriv("aes-128-gcm",Buffer.from(a.aesKeyBuffer),Buffer.from(n));return Buffer.concat([r.update(JSON.stringify(e),"utf-8"),r.final(),r.getAuthTag()]).toString("base64")},decryptFlowMedia:async function(e){const a=[];for(const n of e){let{cdn_url:e,encryption_metadata:r}=n;if("EXAMPLE_DATA__CDN_URL_WILL_COME_IN_THIS_FIELD"===e){e="https://picsum.photos/seed/picsum/200";const t=await H(e);a.push(t);continue}const o=await H(e),{iv:s,encryption_key:i,hmac_key:c,encrypted_hash:l,plaintext_hash:d}=r,p={iv:Buffer.from(s,"base64"),encryption_key:Buffer.from(i,"base64"),hmac_key:Buffer.from(c,"base64")};if(t.default.createHash("sha256").update(o).digest("base64")!==l)throw new Error("Encrypted hash validation failed");const u=o.subarray(0,o.length-10),f=o.subarray(-10);if(!t.default.createHmac("sha256",p.hmac_key).update(Buffer.concat([p.iv,u])).digest().subarray(0,10).equals(f))throw new Error("HMAC validation failed");const m=t.default.createDecipheriv("aes-256-cbc",p.encryption_key,p.iv),y=m.update(u),_=Buffer.concat([y,m.final()]);if(t.default.createHash("sha256").update(_).digest("base64")!==d)throw new Error("Decrypted media hash validation failed");a.push(_)}return a}},O={flows:P},k=null;exports.BCP47LanguageTag=N,exports.WhatsappErrorCode=l,exports.actions=D,exports.createWhatsapp=()=>k||(k=(()=>{const{settings:e}=u,{actions:t,flows:a,parsers:n,security:o,utils:s,toGraphLanguageTag:i}=d,{endpoints:c}=r;return{settings:e,sdk:{actions:t,flows:a,parsers:n,security:o,utils:s,toGraphLanguageTag:i},graph:{endpoints:c}}})()),exports.endpoints=c,exports.flows=P,exports.flowsEndpoints=o,exports.messagesEndpoints=s,exports.parsers=L,exports.security=x,exports.toGraphLanguageTag=I,exports.utils=O,exports.wabaEndpoints=i;
|
package/dist/index.d.cts
CHANGED
|
@@ -17,65 +17,6 @@ type Endpoint<Url extends string, Method extends HttpMethod, Req extends IReques
|
|
|
17
17
|
response?: Res;
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
/**
|
|
21
|
-
* This follows the BCP 47 language tag format.
|
|
22
|
-
*/
|
|
23
|
-
declare enum LanguageTag {
|
|
24
|
-
AR_SA = "ar-SA",
|
|
25
|
-
BN_BD = "bn-BD",
|
|
26
|
-
BN_IN = "bn-IN",
|
|
27
|
-
CS_CZ = "cs-CZ",
|
|
28
|
-
DA_DK = "da-DK",
|
|
29
|
-
DE_AT = "de-AT",
|
|
30
|
-
DE_CH = "de-CH",
|
|
31
|
-
DE_DE = "de-DE",
|
|
32
|
-
EL_GR = "el-GR",
|
|
33
|
-
EN_AU = "en-AU",
|
|
34
|
-
EN_CA = "en-CA",
|
|
35
|
-
EN_GB = "en-GB",
|
|
36
|
-
EN_IE = "en-IE",
|
|
37
|
-
EN_IN = "en-IN",
|
|
38
|
-
EN_NZ = "en-NZ",
|
|
39
|
-
EN_US = "en-US",
|
|
40
|
-
EN_ZA = "en-ZA",
|
|
41
|
-
ES_AR = "es-AR",
|
|
42
|
-
ES_CL = "es-CL",
|
|
43
|
-
ES_CO = "es-CO",
|
|
44
|
-
ES_ES = "es-ES",
|
|
45
|
-
ES_MX = "es-MX",
|
|
46
|
-
ES_US = "es-US",
|
|
47
|
-
FI_FI = "fi-FI",
|
|
48
|
-
FR_BE = "fr-BE",
|
|
49
|
-
FR_CA = "fr-CA",
|
|
50
|
-
FR_CH = "fr-CH",
|
|
51
|
-
FR_FR = "fr-FR",
|
|
52
|
-
HE_IL = "he-IL",
|
|
53
|
-
HI_IN = "hi-IN",
|
|
54
|
-
HU_HU = "hu-HU",
|
|
55
|
-
ID_ID = "id-ID",
|
|
56
|
-
IT_CH = "it-CH",
|
|
57
|
-
IT_IT = "it-IT",
|
|
58
|
-
JA_JP = "ja-JP",
|
|
59
|
-
KO_KR = "ko-KR",
|
|
60
|
-
NL_BE = "nl-BE",
|
|
61
|
-
NL_NL = "nl-NL",
|
|
62
|
-
NO_NO = "no-NO",
|
|
63
|
-
PL_PL = "pl-PL",
|
|
64
|
-
PT_BR = "pt-BR",
|
|
65
|
-
PT_PT = "pt-PT",
|
|
66
|
-
RO_RO = "ro-RO",
|
|
67
|
-
RU_RU = "ru-RU",
|
|
68
|
-
SK_SK = "sk-SK",
|
|
69
|
-
SV_SE = "sv-SE",
|
|
70
|
-
TA_IN = "ta-IN",
|
|
71
|
-
TA_LK = "ta-LK",
|
|
72
|
-
TH_TH = "th-TH",
|
|
73
|
-
TR_TR = "tr-TR",
|
|
74
|
-
ZH_CN = "zh-CN",
|
|
75
|
-
ZH_HK = "zh-HK",
|
|
76
|
-
ZH_TW = "zh-TW"
|
|
77
|
-
}
|
|
78
|
-
|
|
79
20
|
interface FlowMediaData {
|
|
80
21
|
media_id: string;
|
|
81
22
|
cdn_url: string;
|
|
@@ -1704,19 +1645,21 @@ type WaSDKFlowExchangeEventPayload = WaSDKFlowDecryptedWebhookBody & {
|
|
|
1704
1645
|
pingResponse: WhatsappFlowPingResponse;
|
|
1705
1646
|
};
|
|
1706
1647
|
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1648
|
+
declare function decryptFlowBody(body: WhatsappFlowEncryptedWebhookBody): WaSDKFlowDecryptedWebhookBody;
|
|
1649
|
+
|
|
1650
|
+
declare function generateWabaEncryption(): Promise<{
|
|
1651
|
+
passphrase: `${string}-${string}-${string}-${string}-${string}`;
|
|
1652
|
+
publicKey: string;
|
|
1653
|
+
privateKey: string;
|
|
1654
|
+
}>;
|
|
1655
|
+
|
|
1656
|
+
type WebhookSignatureChallengeArguments = {
|
|
1657
|
+
rawBody: string;
|
|
1658
|
+
untrustedSignature: string;
|
|
1711
1659
|
};
|
|
1660
|
+
declare function verifySignature(request: Request, rawBody: string): Promise<boolean>;
|
|
1712
1661
|
|
|
1713
|
-
|
|
1714
|
-
messageId: string;
|
|
1715
|
-
metadata: string;
|
|
1716
|
-
timestamp: number;
|
|
1717
|
-
errors: WaIncomingErrors;
|
|
1718
|
-
status: WaIncomingMessageStatuses;
|
|
1719
|
-
}
|
|
1662
|
+
declare function verifyHub(request: Request): string | false;
|
|
1720
1663
|
|
|
1721
1664
|
interface BaseMessageReceivedEventPayload {
|
|
1722
1665
|
id: string;
|
|
@@ -1759,6 +1702,52 @@ type MessageReceivedEventPayload = BaseMessageReceivedEventPayload & {
|
|
|
1759
1702
|
};
|
|
1760
1703
|
};
|
|
1761
1704
|
|
|
1705
|
+
interface MessageStatusUpdateEvent {
|
|
1706
|
+
messageId: string;
|
|
1707
|
+
metadata: string;
|
|
1708
|
+
timestamp: number;
|
|
1709
|
+
errors: WaIncomingErrors;
|
|
1710
|
+
status: WaIncomingMessageStatuses;
|
|
1711
|
+
}
|
|
1712
|
+
|
|
1713
|
+
type FlowUpdateEventPayload = {
|
|
1714
|
+
event: string;
|
|
1715
|
+
message: string;
|
|
1716
|
+
flow_id: string;
|
|
1717
|
+
};
|
|
1718
|
+
|
|
1719
|
+
interface WaSDKEventPayload {
|
|
1720
|
+
healthCheck: string;
|
|
1721
|
+
flowExchange: WaSDKFlowExchangeEventPayload;
|
|
1722
|
+
application: {
|
|
1723
|
+
errors?: WaIncomingErrors[];
|
|
1724
|
+
profileUpdate?: BaseMessageReceivedEventPayload & {
|
|
1725
|
+
identity: WaIncomingIdentityObject;
|
|
1726
|
+
system: WaIncomingSystemObject;
|
|
1727
|
+
}[];
|
|
1728
|
+
messageStatusUpdate?: MessageStatusUpdateEvent[];
|
|
1729
|
+
messageReceived?: MessageReceivedEventPayload[];
|
|
1730
|
+
flowUpdate?: FlowUpdateEventPayload[];
|
|
1731
|
+
};
|
|
1732
|
+
}
|
|
1733
|
+
type WaSDKEventType = keyof WaSDKEventPayload;
|
|
1734
|
+
interface WaSDKEvent<T extends WaSDKEventType = WaSDKEventType> {
|
|
1735
|
+
type: T;
|
|
1736
|
+
payload: WaSDKEventPayload[T];
|
|
1737
|
+
}
|
|
1738
|
+
|
|
1739
|
+
declare function webhook(request: Request): Promise<WaSDKEvent<"healthCheck"> | WaSDKEvent<"application"> | WaSDKEvent<"flowExchange">>;
|
|
1740
|
+
|
|
1741
|
+
declare function uploadWabaEncryption(publicKey: string): Promise<unknown>;
|
|
1742
|
+
|
|
1743
|
+
interface Payload {
|
|
1744
|
+
pin: string;
|
|
1745
|
+
dataRegion?: ISOCountryCode;
|
|
1746
|
+
}
|
|
1747
|
+
declare function registerNumber({ dataRegion, pin }: Payload): Promise<unknown>;
|
|
1748
|
+
|
|
1749
|
+
declare function _delete(flow_id: string): Promise<WhatsappDeleteFlowResponse>;
|
|
1750
|
+
|
|
1762
1751
|
type WaSDKButtonMessage = Omit<WaInteractiveBase, "type"> & {
|
|
1763
1752
|
type: "button";
|
|
1764
1753
|
buttons: Array<{
|
|
@@ -1842,9 +1831,68 @@ type WaSDKOutgoingMediaMessage = {
|
|
|
1842
1831
|
};
|
|
1843
1832
|
};
|
|
1844
1833
|
|
|
1834
|
+
/**
|
|
1835
|
+
* This follows the BCP 47 language tag format.
|
|
1836
|
+
*/
|
|
1837
|
+
declare enum BCP47LanguageTag {
|
|
1838
|
+
AR_SA = "ar-SA",
|
|
1839
|
+
BN_BD = "bn-BD",
|
|
1840
|
+
BN_IN = "bn-IN",
|
|
1841
|
+
CS_CZ = "cs-CZ",
|
|
1842
|
+
DA_DK = "da-DK",
|
|
1843
|
+
DE_AT = "de-AT",
|
|
1844
|
+
DE_CH = "de-CH",
|
|
1845
|
+
DE_DE = "de-DE",
|
|
1846
|
+
EL_GR = "el-GR",
|
|
1847
|
+
EN_AU = "en-AU",
|
|
1848
|
+
EN_CA = "en-CA",
|
|
1849
|
+
EN_GB = "en-GB",
|
|
1850
|
+
EN_IE = "en-IE",
|
|
1851
|
+
EN_IN = "en-IN",
|
|
1852
|
+
EN_NZ = "en-NZ",
|
|
1853
|
+
EN_US = "en-US",
|
|
1854
|
+
EN_ZA = "en-ZA",
|
|
1855
|
+
ES_AR = "es-AR",
|
|
1856
|
+
ES_CL = "es-CL",
|
|
1857
|
+
ES_CO = "es-CO",
|
|
1858
|
+
ES_ES = "es-ES",
|
|
1859
|
+
ES_MX = "es-MX",
|
|
1860
|
+
ES_US = "es-US",
|
|
1861
|
+
FI_FI = "fi-FI",
|
|
1862
|
+
FR_BE = "fr-BE",
|
|
1863
|
+
FR_CA = "fr-CA",
|
|
1864
|
+
FR_CH = "fr-CH",
|
|
1865
|
+
FR_FR = "fr-FR",
|
|
1866
|
+
HE_IL = "he-IL",
|
|
1867
|
+
HI_IN = "hi-IN",
|
|
1868
|
+
HU_HU = "hu-HU",
|
|
1869
|
+
ID_ID = "id-ID",
|
|
1870
|
+
IT_CH = "it-CH",
|
|
1871
|
+
IT_IT = "it-IT",
|
|
1872
|
+
JA_JP = "ja-JP",
|
|
1873
|
+
KO_KR = "ko-KR",
|
|
1874
|
+
NL_BE = "nl-BE",
|
|
1875
|
+
NL_NL = "nl-NL",
|
|
1876
|
+
NO_NO = "no-NO",
|
|
1877
|
+
PL_PL = "pl-PL",
|
|
1878
|
+
PT_BR = "pt-BR",
|
|
1879
|
+
PT_PT = "pt-PT",
|
|
1880
|
+
RO_RO = "ro-RO",
|
|
1881
|
+
RU_RU = "ru-RU",
|
|
1882
|
+
SK_SK = "sk-SK",
|
|
1883
|
+
SV_SE = "sv-SE",
|
|
1884
|
+
TA_IN = "ta-IN",
|
|
1885
|
+
TA_LK = "ta-LK",
|
|
1886
|
+
TH_TH = "th-TH",
|
|
1887
|
+
TR_TR = "tr-TR",
|
|
1888
|
+
ZH_CN = "zh-CN",
|
|
1889
|
+
ZH_HK = "zh-HK",
|
|
1890
|
+
ZH_TW = "zh-TW"
|
|
1891
|
+
}
|
|
1892
|
+
|
|
1845
1893
|
type WaSDKOutgoingTemplateMessage = Omit<WaOutgoingTemplateMessage, "namespace" | "language"> & {
|
|
1846
1894
|
type: "template";
|
|
1847
|
-
language: `${
|
|
1895
|
+
language: `${BCP47LanguageTag}`;
|
|
1848
1896
|
};
|
|
1849
1897
|
|
|
1850
1898
|
type WaSDKOutgoingTextMessage = {
|
|
@@ -1865,67 +1913,6 @@ type WaSDKSendMessageBody = WaSDKSendMessageConfig & {
|
|
|
1865
1913
|
message: WaSDKSendMessageData;
|
|
1866
1914
|
};
|
|
1867
1915
|
|
|
1868
|
-
type WaSDKGetFlowWebPreviewPageRequestQuery = {
|
|
1869
|
-
flow_action: "data_exchange" | "navigate";
|
|
1870
|
-
phone_number: string;
|
|
1871
|
-
interactive?: boolean;
|
|
1872
|
-
recipient_id?: string;
|
|
1873
|
-
flow_action_payload?: {
|
|
1874
|
-
screen: string;
|
|
1875
|
-
data: Record<string, AnyType>;
|
|
1876
|
-
};
|
|
1877
|
-
flow_parameters?: FlowParameters;
|
|
1878
|
-
};
|
|
1879
|
-
type FlowParameters = Record<string, string | number>;
|
|
1880
|
-
|
|
1881
|
-
declare function decryptFlowBody(body: WhatsappFlowEncryptedWebhookBody): WaSDKFlowDecryptedWebhookBody;
|
|
1882
|
-
|
|
1883
|
-
declare function generateWabaEncryption(): Promise<{
|
|
1884
|
-
passphrase: `${string}-${string}-${string}-${string}-${string}`;
|
|
1885
|
-
publicKey: string;
|
|
1886
|
-
privateKey: string;
|
|
1887
|
-
}>;
|
|
1888
|
-
|
|
1889
|
-
type WebhookSignatureChallengeArguments = {
|
|
1890
|
-
rawBody: string;
|
|
1891
|
-
untrustedSignature: string;
|
|
1892
|
-
};
|
|
1893
|
-
declare function verifySignature(request: Request, rawBody: string): Promise<boolean>;
|
|
1894
|
-
|
|
1895
|
-
declare function verifyHub(request: Request): string | false;
|
|
1896
|
-
|
|
1897
|
-
interface WaSDKEventPayload {
|
|
1898
|
-
healthCheck: string;
|
|
1899
|
-
flowExchange: WaSDKFlowExchangeEventPayload;
|
|
1900
|
-
application: {
|
|
1901
|
-
errors?: WaIncomingErrors[];
|
|
1902
|
-
profileUpdate?: BaseMessageReceivedEventPayload & {
|
|
1903
|
-
identity: WaIncomingIdentityObject;
|
|
1904
|
-
system: WaIncomingSystemObject;
|
|
1905
|
-
}[];
|
|
1906
|
-
messageStatusUpdate?: MessageStatusUpdateEvent[];
|
|
1907
|
-
messageReceived?: MessageReceivedEventPayload[];
|
|
1908
|
-
flowUpdate?: FlowUpdateEventPayload[];
|
|
1909
|
-
};
|
|
1910
|
-
}
|
|
1911
|
-
type WaSDKEventType = keyof WaSDKEventPayload;
|
|
1912
|
-
interface WaSDKEvent<T extends WaSDKEventType = WaSDKEventType> {
|
|
1913
|
-
type: T;
|
|
1914
|
-
payload: WaSDKEventPayload[T];
|
|
1915
|
-
}
|
|
1916
|
-
|
|
1917
|
-
declare function webhook(request: Request): Promise<WaSDKEvent<"healthCheck"> | WaSDKEvent<"application"> | WaSDKEvent<"flowExchange">>;
|
|
1918
|
-
|
|
1919
|
-
declare function uploadWabaEncryption(publicKey: string): Promise<unknown>;
|
|
1920
|
-
|
|
1921
|
-
interface Payload {
|
|
1922
|
-
pin: string;
|
|
1923
|
-
dataRegion?: ISOCountryCode;
|
|
1924
|
-
}
|
|
1925
|
-
declare function registerNumber({ dataRegion, pin }: Payload): Promise<unknown>;
|
|
1926
|
-
|
|
1927
|
-
declare function _delete(flow_id: string): Promise<WhatsappDeleteFlowResponse>;
|
|
1928
|
-
|
|
1929
1916
|
declare function send(body: WaSDKSendMessageBody): Promise<WhatsappSendMessageResponse>;
|
|
1930
1917
|
|
|
1931
1918
|
declare const actions: {
|
|
@@ -1967,7 +1954,7 @@ declare const parsers: {
|
|
|
1967
1954
|
};
|
|
1968
1955
|
};
|
|
1969
1956
|
|
|
1970
|
-
declare const toGraphLanguageTag: (languageTag: `${
|
|
1957
|
+
declare const toGraphLanguageTag: (languageTag: `${BCP47LanguageTag}`) => WhatsappLanguageTag;
|
|
1971
1958
|
|
|
1972
1959
|
type MessageReceivedEvent = Defined<WaSDKEventPayload["application"]["messageReceived"]>[0];
|
|
1973
1960
|
|
|
@@ -1980,6 +1967,19 @@ declare const security: {
|
|
|
1980
1967
|
decryptFlowMedia: typeof decryptFlowMedia;
|
|
1981
1968
|
};
|
|
1982
1969
|
|
|
1970
|
+
type WaSDKGetFlowWebPreviewPageRequestQuery = {
|
|
1971
|
+
flow_action: "data_exchange" | "navigate";
|
|
1972
|
+
phone_number: string;
|
|
1973
|
+
interactive?: boolean;
|
|
1974
|
+
recipient_id?: string;
|
|
1975
|
+
flow_action_payload?: {
|
|
1976
|
+
screen: string;
|
|
1977
|
+
data: Record<string, AnyType>;
|
|
1978
|
+
};
|
|
1979
|
+
flow_parameters?: FlowParameters;
|
|
1980
|
+
};
|
|
1981
|
+
type FlowParameters = Record<string, string | number>;
|
|
1982
|
+
|
|
1983
1983
|
declare const flows: {
|
|
1984
1984
|
createToken: ({ flow_name, flow_parameters, chatId, }: {
|
|
1985
1985
|
flow_name: string;
|
|
@@ -2112,7 +2112,7 @@ declare const createWhatsapp: () => {
|
|
|
2112
2112
|
};
|
|
2113
2113
|
};
|
|
2114
2114
|
};
|
|
2115
|
-
toGraphLanguageTag: (languageTag: `${
|
|
2115
|
+
toGraphLanguageTag: (languageTag: `${BCP47LanguageTag}`) => WhatsappLanguageTag;
|
|
2116
2116
|
};
|
|
2117
2117
|
graph: {
|
|
2118
2118
|
endpoints: {
|
|
@@ -2151,4 +2151,4 @@ declare const createWhatsapp: () => {
|
|
|
2151
2151
|
};
|
|
2152
2152
|
};
|
|
2153
2153
|
|
|
2154
|
-
export { type BaseMessageReceivedEventPayload, type ConversationType, type DataExchangeFlowConfig, type FlowAction, type FlowCanSendMessageStatus, type FlowCategory, type FlowConfig, type FlowData, type FlowMediaData, type FlowMetadata, type FlowParameters, type FlowScreen, type FlowStatus, type FlowUpdateEventPayload, type FlowValidationError, type ISOCountryCode, type MediaTypes, type MessageField, type MessageReceivedEvent, type MessageReceivedEventPayload, type MessageStatusUpdateEvent, type MetadataObject, type NavigateFlowConfig, type Payload, type WaIncomingAudioObject, type WaIncomingButtonObject, type WaIncomingContactObject, type WaIncomingContacts, type WaIncomingContextObject, type WaIncomingDocumentObject, type WaIncomingErrorObject, type WaIncomingErrors, type WaIncomingIdentityObject, type WaIncomingImageObject, type WaIncomingInteractiveObject, type WaIncomingMessageStatus, type WaIncomingMessageStatuses, type WaIncomingMessageType, type WaIncomingMessages, type WaIncomingOrderObject, type WaIncomingReferralObject, type WaIncomingStickerObject, type WaIncomingSystemObject, type WaIncomingTextObject, type WaIncomingVideoObject, type WaInteractiveAction, type WaInteractiveActionType, type WaInteractiveBase, type WaInteractiveBody, type WaInteractiveFooter, type WaInteractiveHeader, type WaMessageType, type WaOutgoingAudioMessage, type WaOutgoingContactsMessage, type WaOutgoingDocumentMessage, type WaOutgoingImageMessage, type WaOutgoingInteractiveMessage, type WaOutgoingLocationMessage, type WaOutgoingMessage, type WaOutgoingReactionMessage, type WaOutgoingStickerMessage, type WaOutgoingTemplateMessage, type WaOutgoingTextMessage, type WaOutgoingVideoMessage, type WaSDKButtonMessage, type WaSDKEvent, type WaSDKEventPayload, type WaSDKEventType, type WaSDKFlowDecryptedWebhookBody, type WaSDKFlowExchangeEventPayload, type WaSDKFlowPayload, type WaSDKGetFlowWebPreviewPageRequestQuery, type WaSDKOutgoingContactMessage, type WaSDKOutgoingFlowMessage, type WaSDKOutgoingListMessage, type WaSDKOutgoingMediaMessage, type WaSDKOutgoingTemplateMessage, type WaSDKOutgoingTextMessage, type WaSDKSendMessageBody, type WaSDKSendMessageConfig, type WaSDKSendMessageData, type WebhookSignatureChallengeArguments, type WhatsappApplicationWebhookBody, type WhatsappCreateFlowRequestBody, type WhatsappCreateFlowResponse, type WhatsappDeleteFlowResponse, WhatsappErrorCode, type WhatsappFlowDecryptedWebhookBody, type WhatsappFlowEncryptedWebhookBody, type WhatsappFlowEncryptionData, type WhatsappFlowErrorMessages, type WhatsappFlowInfo, type WhatsappFlowPingResponse, type WhatsappFlowResponse, type WhatsappFlowUpdateMetadataRequestBody, type WhatsappFlowUpdateMetadataResponse, type WhatsappGetFlowWebPreviewPageRequestQuery, type WhatsappGetFlowWebPreviewURLResponse, type WhatsappGetFlowsRequestQuery, type WhatsappGetFlowsRequestResponse, type WhatsappGetManyFlowsRequestResponse, type WhatsappLanguageTag, type WhatsappPublishFlowResponse, type WhatsappRegisterPhoneNumberRequestBody, type WhatsappSendMessageRequestBody, type WhatsappSendMessageRequestConfig, type WhatsappSendMessageResponse, type WhatsappUpdateFlowJsonRequestBody, type WhatsappUpdateFlowJsonResponse, type WhatsappWabaUploadEncryptionRequestBody, actions, createWhatsapp, endpoints, flows, flowsEndpoints, messagesEndpoints, parsers, security, toGraphLanguageTag, utils, wabaEndpoints };
|
|
2154
|
+
export { BCP47LanguageTag, type BaseMessageReceivedEventPayload, type ConversationType, type DataExchangeFlowConfig, type FlowAction, type FlowCanSendMessageStatus, type FlowCategory, type FlowConfig, type FlowData, type FlowMediaData, type FlowMetadata, type FlowParameters, type FlowScreen, type FlowStatus, type FlowUpdateEventPayload, type FlowValidationError, type ISOCountryCode, type MediaTypes, type MessageField, type MessageReceivedEvent, type MessageReceivedEventPayload, type MessageStatusUpdateEvent, type MetadataObject, type NavigateFlowConfig, type Payload, type WaIncomingAudioObject, type WaIncomingButtonObject, type WaIncomingContactObject, type WaIncomingContacts, type WaIncomingContextObject, type WaIncomingDocumentObject, type WaIncomingErrorObject, type WaIncomingErrors, type WaIncomingIdentityObject, type WaIncomingImageObject, type WaIncomingInteractiveObject, type WaIncomingMessageStatus, type WaIncomingMessageStatuses, type WaIncomingMessageType, type WaIncomingMessages, type WaIncomingOrderObject, type WaIncomingReferralObject, type WaIncomingStickerObject, type WaIncomingSystemObject, type WaIncomingTextObject, type WaIncomingVideoObject, type WaInteractiveAction, type WaInteractiveActionType, type WaInteractiveBase, type WaInteractiveBody, type WaInteractiveFooter, type WaInteractiveHeader, type WaMessageType, type WaOutgoingAudioMessage, type WaOutgoingContactsMessage, type WaOutgoingDocumentMessage, type WaOutgoingImageMessage, type WaOutgoingInteractiveMessage, type WaOutgoingLocationMessage, type WaOutgoingMessage, type WaOutgoingReactionMessage, type WaOutgoingStickerMessage, type WaOutgoingTemplateMessage, type WaOutgoingTextMessage, type WaOutgoingVideoMessage, type WaSDKButtonMessage, type WaSDKEvent, type WaSDKEventPayload, type WaSDKEventType, type WaSDKFlowDecryptedWebhookBody, type WaSDKFlowExchangeEventPayload, type WaSDKFlowPayload, type WaSDKGetFlowWebPreviewPageRequestQuery, type WaSDKOutgoingContactMessage, type WaSDKOutgoingFlowMessage, type WaSDKOutgoingListMessage, type WaSDKOutgoingMediaMessage, type WaSDKOutgoingTemplateMessage, type WaSDKOutgoingTextMessage, type WaSDKSendMessageBody, type WaSDKSendMessageConfig, type WaSDKSendMessageData, type WebhookSignatureChallengeArguments, type WhatsappApplicationWebhookBody, type WhatsappCreateFlowRequestBody, type WhatsappCreateFlowResponse, type WhatsappDeleteFlowResponse, WhatsappErrorCode, type WhatsappFlowDecryptedWebhookBody, type WhatsappFlowEncryptedWebhookBody, type WhatsappFlowEncryptionData, type WhatsappFlowErrorMessages, type WhatsappFlowInfo, type WhatsappFlowPingResponse, type WhatsappFlowResponse, type WhatsappFlowUpdateMetadataRequestBody, type WhatsappFlowUpdateMetadataResponse, type WhatsappGetFlowWebPreviewPageRequestQuery, type WhatsappGetFlowWebPreviewURLResponse, type WhatsappGetFlowsRequestQuery, type WhatsappGetFlowsRequestResponse, type WhatsappGetManyFlowsRequestResponse, type WhatsappLanguageTag, type WhatsappPublishFlowResponse, type WhatsappRegisterPhoneNumberRequestBody, type WhatsappSendMessageRequestBody, type WhatsappSendMessageRequestConfig, type WhatsappSendMessageResponse, type WhatsappUpdateFlowJsonRequestBody, type WhatsappUpdateFlowJsonResponse, type WhatsappWabaUploadEncryptionRequestBody, actions, createWhatsapp, endpoints, flows, flowsEndpoints, messagesEndpoints, parsers, security, toGraphLanguageTag, utils, wabaEndpoints };
|