Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: se soluciona problemas con sendContacts para el provider meta #909

Merged
merged 4 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified .husky/commit-msg
100644 → 100755
Empty file.
Empty file modified .husky/pre-commit
100644 → 100755
Empty file.
Empty file modified .husky/pre-push
100644 → 100755
Empty file.
66 changes: 46 additions & 20 deletions packages/provider/src/meta/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -394,14 +394,14 @@ class MetaProvider extends ProviderClass {
text: 'text-string',
},
{
type: "currency",
type: 'currency',
currency: {
fallback_value: "$100.99",
code: "USD",
amount_1000: 100990
}
fallback_value: '$100.99',
code: 'USD',
amount_1000: 100990,
},
},
]
],
},
{
type: 'button',
Expand All @@ -410,13 +410,13 @@ class MetaProvider extends ProviderClass {
parameters: [
{
type: 'payload',
payload: 'aGlzIHRoaXMgaXMgY29v'
payload: 'aGlzIHRoaXMgaXMgY29v',
},
],
},
]
],
},
};
}
return this.sendMessageMeta(body)
}

Expand All @@ -431,14 +431,40 @@ class MetaProvider extends ProviderClass {
const parseContacts = contact.map((contact) => ({
name: {
formatted_name: contact.name,
first_name: contact.first_name,
last_name: contact.last_name,
middle_name: contact.middle_name,
suffix: contact.suffix,
prefix: contact.prefix,
},
phone: [
{
phone: contact.phone,
wa_id: contact.phone,
type: 'MOBILE',
},
],
birthday: contact.birthday,
phones: contact.phones.map((phone) => ({
phone: phone.phone,
wa_id: phone.wa_id,
type: phone.type,
})),
emails: contact.emails.map((email) => ({
email: email.email,
type: email.type,
})),
org: {
company: contact.company,
department: contact.department,
title: contact.title,
},
urls: contact.urls.map((url) => ({
url: url.url,
type: url.type,
})),
addresses: contact.addresses.map((address) => ({
street: address.street,
city: address.city,
state: address.state,
zip: address.zip,
country: address.country,
country_code: address.counry_code,
type: address.type,
})),
}))

const body = {
Expand Down Expand Up @@ -474,10 +500,10 @@ class MetaProvider extends ProviderClass {
action: {
name: 'catalog_message',
parameters: {
"thumbnail_product_retailer_id": itemCatalogId,
}
}
}
thumbnail_product_retailer_id: itemCatalogId,
},
},
},
}
return this.sendMessageMeta(body)
}
Expand Down