fbsamples / whatsapp-api-examples Goto Github PK
View Code? Open in Web Editor NEWExamples of how to use WhatsApp Cloud API on the WhatsApp Business Platform
License: Other
Examples of how to use WhatsApp Cloud API on the WhatsApp Business Platform
License: Other
can u please provide python method to get and update WhatsApp api business profile and please also qr code sending option method in python.
For those who have access to GitHub's Maintainers Org for OSS devs, Meta may be one of the worst enemies OSS has. Will there be healing or war? You decide.
https://github.com/community/maintainers/discussions/341#discussioncomment-6493532
I'm trying upload a image o whatsapp server but return an error:
error: {
message: '(#100) Param file must be a file with one of the following types: audio/aac, audio/mp4, audio/mpeg, audio/amr, audio/ogg, audio/opus, application/vnd.ms-powerpoint, application/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document, application/vnd.openxmlformats-officedocument.presentationml.presentation, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/pdf, text/plain, application/vnd.ms-excel, image/jpeg, image/png, image/webp, video/mp4, video/3gpp.',
type: 'OAuthException',
code: 100,
fbtrace_id: 'AM2yIhYd_KoSd5dQerkfErV'
}
code:
const config: AxiosRequestConfig = {
method: 'post',
url: `https://graph.facebook.com/${this._version}/${envs.BOT_PHONE_ID}/media`,
headers: {
Authorization: `Bearer ${envs.WHATSAPP_TOKEN}`,
'content-type': 'multipart/form-data',
},
data: {
file: {
value: fs.createReadStream(file.path),
options: {
filename: file.filename,
contentType: file.mimetype,
},
},
type: file.mimetype,
messaging_product: 'whatsapp',
},
}
const { data } = await axios(config)
I've been try, but always the template is rejected
on https://developers.facebook.com/ u config only one callback url. for me that means u can only use one endpoint to config your webhook. how did you config it ?
I'm trying delete a template following the example below:
exports.deleteMessageTemplate = async (req, res) => {
request.delete(
{
url: `https://graph.facebook.com/v13.0/${process.env.META_BUSINESS_ID}/message_templates`,
headers: {
Authorization: `Bearer ${process.env.META_AUTH_TOKEN}`,
"content-type": "application/json",
},
body: JSON.stringify({
name: req.body.name,
}),
},
function (err, resp, body) {
if (err) {
console.log("Error!");
} else {
res.json(JSON.parse(body));
}
}
);
};
My code:
#deleteTemplate(data: any) {
const config: AxiosRequestConfig = {
method: 'post',
url: `https://graph.facebook.com/${this._version}/${envs.WHATSAPP_BUSINESS_SECRET}/message_templates`,
headers: {
Authorization: `Bearer ${this._token}`,
'Content-Type': 'application/json',
},
data,
}
return axios(config)
}
async DEL(req: Request, res: Response) {
const body = req.body
try {
await this.#deleteTemplate(body)
res.status(200).send({
title: 'Template excluído com sucesso!',
desc: 'A alteração pode demorar algum tempo para ser confirmado.',
})
} catch (error) {
if (error instanceof AxiosError) {
const errorData = error.response?.data
if (errorData.error.code === 100) {
res.status(401).send(errorData.error.message)
return
}
console.log('🚀 ~ Template ~ DEL ~ tes:', errorData)
return
}
console.log(error)
}
}
clientRoute.delete(
'/client/template',
async (req, res) => await template.DEL(req, res),
)
body:
{
"name": "test"
}
I'm try with id as well, but nothing, always return an error, similar this:
(#100) The parameter language is required.
I've been add all parameters that it say and nothing.
When I finally managed to create my first WhatsAppp application in this obstacles course that are the Meta backoffice pages (BTW, I have never seen such "thing" in terms of ergonomics that would make Steve Jobs turn in his grave, that is to say dispersing in myriads of different places on each page links to same pages and functionalities), I got only the "Hello World" template.
Nowhere in the documentation I was able to find where and how to get the others mentioned in those examples.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.