Skip to content

Commit

Permalink
Update index.js
Browse files Browse the repository at this point in the history
  • Loading branch information
ayadag authored Dec 15, 2023
1 parent e0b20f2 commit 6605d1e
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ app.listen(port,()=>{
});*/

/*function fn(mykey){
function fn(mykey){
sendHttpRequest('GET', 'https://chatbasebot.com/version-test/api/1.1/wf/xyzg?key='+mykey+'/').then(responseData => {
let mytoken1=responseData.response.mytoken;
return mytoken1;
})
};*/
};


//to verify the callback url from dashboard side - cloud api side
Expand All @@ -39,19 +39,17 @@ app.get("/api/whatsapp",(req,res)=>{
//let mytoken="12345";
//let mytoken = fn(mykey);

axios.get('https://chatbasebot.com/version-test/api/1.1/wf/xyzg?key='+mykey+'/')
.then((response) => {
console.log(response.data.response.mytoken);
let mytoken = response.data.response.mytoken;

if(mode && token){

let mytoken = fn(mykey);

if(mode==="subscribe" && token===mytoken){
res.status(200).send(challange)
}else{
res.status(403)
}
}
})

});

Expand Down

0 comments on commit 6605d1e

Please sign in to comment.