From ac0ab7ab307734099af62867633a3ee8ba7e4eee Mon Sep 17 00:00:00 2001 From: schwasa <102740850+schwasa@users.noreply.github.com> Date: Fri, 15 Mar 2024 16:38:50 +0100 Subject: [PATCH] "Update App Rem Counter" --- app.js | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/app.js b/app.js index c5e9476..f15389f 100644 --- a/app.js +++ b/app.js @@ -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');