Skip to content
This repository was archived by the owner on Dec 5, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions img/avatar/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<p>Hi</p>
<%= data.reviewer.name; %> has been intimated for your assignment review
Iss test ko dene ke liye aap jald hi, yeh website - http://join.navgurukul.org/k/<%= it.key; %> kholein aur test ko de. Test dene ke liye aap apne paas ek notebook aur pen tayyar rakhe, aur apne answers ko apne phone mei hi answer karein.


1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"db-migrate": "^0.11.5",
"db-migrate-mysql": "^1.1.10",
"diff": "3.2.0",
"ejs": "^2.6.1",
"express": "^4.16.4",
"fs": "0.0.2",
"fs-extra": "^3.0.1",
Expand Down
116 changes: 105 additions & 11 deletions src/cliq.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,134 @@ import * as CustomRequest from "request";

import * as Configs from "./configurations";

import * as ejs from "ejs";
import * as messageHelper from "./helpers/messageHelper";

interface Details {
receiverId: string;
message: string;

}

const cliqConfigs=Configs.getCliqConfig();
const cliqConfigs = Configs.getCliqConfig();

export const sendCliqIntimation = (details: Details) => {

return new Promise(function (resolve, reject) {

CustomRequest.post(`https://cliq.zoho.com/api/v2/buddies/${details.receiverId}/message?authtoken=${cliqConfigs.authtoken}`, {
json: {
text: `${details.message}`
}
}, function (error, response, body) {



if (!error && response.statusCode == 204) {

console.log('message sent successsfully')
return resolve(response.statusCode);
//console.log(body) // Show the HTML for the Google homepage.
} else {
console.log(body);
return resolve(body);
}





})
});
};


export const sendCliqIntimationTest = (filename, data) => {
// Email template

return new Promise(function (resolve, reject) {

let cliqBaseApiUrl = "https://cliq.zoho.com/api/v2/buddies";
let email = details.receiverId;
let authToken = cliqConfigs.authtoken;

let sendMessageToCliqUrl = `${cliqBaseApiUrl}/${email}/message?authtoken=${authToken}`

var filePath = "img/avatar/";

ejs.renderFile(filePath + filename, { data: data }, {async:true}, function (err, str) {
console.log("what i am getting :", str);

CustomRequest.post(`https://cliq.zoho.com/api/v2/buddies/${data.receiverId}/message?authtoken=${cliqConfigs.authtoken}`, {
json: {
text: `${str}`
}
}, function (error, response, body) {



if (!error && response.statusCode == 204) {

CustomRequest.post(sendMessageToCliqUrl , {
console.log('message sent successsfully')
return resolve(response.statusCode);
//console.log(body) // Show the HTML for the Google homepage.
} else {
console.log(body);
return resolve(body);
}





})





// str => Rendered HTML string
});










});
}


export const sendCliqIntimationMessagetest = (functionname, details) => {
// Email template

return new Promise(function (resolve, reject) {


// console.log(messageHelper["getforIndivisualTimePeriod"]());
console.log("Message is goint to sent===>",messageHelper[`${functionname}`](details.messageArgs),"------");



CustomRequest.post(`https://cliq.zoho.com/api/v2/buddies/${details.receiverEmail}/message?authtoken=${cliqConfigs.authtoken}`, {
json: {
text: `${details.message}`
text: messageHelper[`${functionname}`](details.messageArgs)
}
}, function (error, response, body) {



if (!error && response.statusCode == 204) {


console.log('message sent successsfully')
return resolve(response.statusCode);
//
//console.log(body) // Show the HTML for the Google homepage.
} else {

console.log(body);
return resolve(body);
}


})
});
};
}
2 changes: 1 addition & 1 deletion src/configurations/sample-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@
"authtoken": "authtoken"
},
"sentryConfig": {
"sentryDsn": "dsn"
"sentryDsn": "https://90e428e8f30142948830e321d5fd382c@sentry.io/1398087"
}
}
Loading