Skip to content

Commit

Permalink
Merge pull request #1099 from ozzyoss77/builderbot
Browse files Browse the repository at this point in the history
Update provider.ts adding requestLocation
  • Loading branch information
leifermendez authored Oct 28, 2024
2 parents 27d700d + 6c9e16c commit 48257f1
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions packages/provider-meta/src/meta/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,15 @@ class MetaProvider extends ProviderClass<MetaInterface> implements MetaInterface
return 'ERROR'
}
}
saveBuffer = async (ctx: Partial<Message & BotContext>, options: SaveFileOptions = {}): Promise<string> => {
try {
const { buffer } = await downloadFile(ctx?.url, this.globalVendorArgs.jwtToken)
return buffer
} catch (err) {
console.log(`[Error]:`, err.message)
return 'ERROR'
}
}

busEvents = () => [
{
Expand Down Expand Up @@ -618,6 +627,26 @@ class MetaProvider extends ProviderClass<MetaInterface> implements MetaInterface
return this.sendMessageMeta(body)
}

requestLocation =async (to, bodyText) => {
to = parseMetaNumber(to);
const body = {
messaging_product: 'whatsapp',
recipient_type: 'individual',
to,
type: 'interactive',
interactive: {
type: 'location_request_message',
body: {
text: bodyText,
},
action: {
name: 'send_location',
},
},
}
return this.sendMessageMeta(body);
}

sendLocation = async (to: string, localization: Localization) => {
to = parseMetaNumber(to)
const { long_number, lat_number, name, address } = localization
Expand Down

0 comments on commit 48257f1

Please sign in to comment.