Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const request = require('request');
- /**
- * Responds to any HTTP request.
- *
- * @param {!express:Request} req HTTP request context.
- * @param {!express:Response} res HTTP response context.
- */
- exports.Support_chef_lavan_integration = (req, res) => {
- const userEmail = req.query.email;
- if (!userEmail) {
- return res.send('email is required');
- }
- const ACTION_URL = 'https://mcgxyy9fs-qckx1drx87pkdskcfq.auth.marketingcloudapis.com/';
- const configurationJson = {
- "grant_type": "client_credentials",
- "client_id": CLIENT_ID,
- "client_secret": CLIENT_SECRET,
- "scope": " data_extensions_write",
- "account_id": ACCOUNT_ID
- };
- /*req.query
- fetch(ACTION_URL, {
- method: 'post',
- body: JSON.stringify(configurationJson),
- headers: {
- 'Content-Type': 'application/json'
- }
- })
- .then(res => {
- console.log('res - ', res);
- res.status(200).send(res);
- });
- */
- const options = {
- url: ACTION_URL,
- method: 'POST',
- body: JSON.stringify(configurationJson),
- headers: {
- 'Content-Type': 'application/json'
- }
- };
- function callback(error, response, body) {
- console.log('1 - response - ', response);
- if (!error && response.statusCode == 200) {
- console.log('2 - response - ', response);
- }
- }
- request(options, callback);
- };
Advertisement
Add Comment
Please, Sign In to add comment