Skip to content

Instantly share code, notes, and snippets.

@jeancarlosgarcia
Last active May 25, 2022 21:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeancarlosgarcia/6daf74ba90017f680441e803bf494683 to your computer and use it in GitHub Desktop.
Save jeancarlosgarcia/6daf74ba90017f680441e803bf494683 to your computer and use it in GitHub Desktop.
const axios = require('axios');
const data ={
messaging_product: 'whatsapp',
to: 'number',
type: "template",
template: {
name: "hello_world",
language: {
code: "en_US"
}
}
};
const headers = {
'Content-Type': 'application/json',
'Authorization' : 'Bearer tocken'
};
axios.post('https://graph.facebook.com/v13.0/{id}/messages', JSON.stringify(data), {headers})
.then((res) => {
console.log(`Status: ${res.status}`);
console.log('Student Info: ', res.data);
}).catch((err) => {
console.error(err);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment