Skip to content

Commit

Permalink
"Update App Rem Counter"
Browse files Browse the repository at this point in the history
  • Loading branch information
schwasa authored Mar 15, 2024
1 parent 7d9fce9 commit ac0ab7a
Showing 1 changed file with 26 additions and 6 deletions.
32 changes: 26 additions & 6 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -791,16 +791,36 @@ app.post('/template/appointscheduler', async (req, res) => {
},
data: data
};

const response = await axios(config);
// Logging the response from the WhatsApp API
console.log('WhatsApp API response:', response.data);

const whatsappResponse = await axios(whatsappConfig);
console.log('WhatsApp API response:', whatsappResponse.data);


// The new API call for App Rem
let apiData = JSON.stringify({
"user_id": user_id,
"topic_name": "app_rem_count",
"time_point": "n.a.",
"query_value": "n.a."
});

let apiConfig = {
method: 'post',
url: 'https://ayo-tracker.azurewebsites.net/v1',
headers: {
'accept': 'application/json',
'Content-Type': 'application/json'
},
data: apiData
};

const apiResponse = await axios(apiConfig);
console.log('Additional API call response:', apiResponse.data);

res.status(200).end();
} catch (error) {
// Detailed error logging
console.error('Error occurred:', error.message);
if (error.response) {
// Log more detailed API response error
console.error('API response error:', error.response.data);
}
res.status(500).send('Internal Server Error');
Expand Down

0 comments on commit ac0ab7a

Please sign in to comment.