<commit_before>const request = require('request');

function callSendAPI(messageData, cb = function(){}) {
  request({
    uri: 'https://graph.facebook.com/v2.8/me/messages',
    qs: { access_token: process.env.PAGE_ACCESS_TOKEN },
    method: 'POST',
    json: messageData

  }, function (error, response, body) {
    if (!error && response.statusCode == 200) {
      var recipientId = body.recipient_id;
      var messageId = body.message_id;

      console.log("Successfully sent generic message with id %s to recipient %s", 
        messageId, recipientId);
      cb();
    } else {
      console.error("Unable to send message.");
      //console.error(response);
      //console.error(error);
      cb();
    }
  });  
}

let sendTextMessage = function (recipientId, messageText, quick_replies = [], cb = function(){}, buttons = []) {
  var messageData = {
    recipient: {
      id: recipientId
    },
    message: {
      text: messageText
    }
  };
  
  if (quick_replies.length > 0) {
    messageData['message']['quick_replies'] = quick_replies;
    console.log("quick_replies length", quick_replies.length);
  }<commit_msg>Implementing carousel of today offers<commit_after>const request = require('request');

function callSendAPI(messageData, cb = function(){}) {
  request({
    uri: 'https://graph.facebook.com/v2.8/me/messages',
    qs: { access_token: process.env.PAGE_ACCESS_TOKEN },
    method: 'POST',
    json: messageData

  }, function (error, response, body) {
    if (!error && response.statusCode == 200) {
      var recipientId = body.recipient_id;
      var messageId = body.message_id;

      console.log("Successfully sent generic message with id %s to recipient %s", 
        messageId, recipientId);
      cb();
    } else {
      console.error("Unable to send message.", error);
      //console.error(response);
      //console.error(error);
      cb();
    }
  });  
}

let sendTextMessage = function (recipientId, messageText, quick_replies = [], cb = function(){}, buttons = []) {
  var messageData = {
    recipient: {
      id: recipientId
    },
    message: {
      text: messageText
    }
  };
  
  if (quick_replies.length > 0) {
    messageData['message']['quick_replies'] = quick_replies;
    console.log("quick_replies length", quick_replies.length);
  }
{'fraction_non_alphanumeric': 0.1439756415832971, 'fraction_numerical': 0.005219660722053067, 'mean_word_length': 3.0636042402826855, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '770102', 'n_tokens_mistral': 719, 'n_tokens_neox': 714, 'n_words': 159}