Giter VIP home page Giter VIP logo

airbnb-parser's Introduction

AirBNB Message Parsing

Parse and extract relevant information from Airbnb email messages.

Install

npm install airbnb-parser

Examples

var AirbnbParser = require("airbnb-parser")
var fs 			 = require("fs");
var path 		 = require("path")

var reservationMsg = {
	html: fs.readFileSync(path.join(__dirname, "msgs/reservation_reply.html")).toString("utf-8"),
	subject: "RE: Reservation request at Ajegunle House for May 9 - 10, 2016",
	replyTo: null
}

AirbnbParser.parse(reservationMsg, function(err, result){
	console.log(err, result)
})

Returns:

{ 
   reservation_reply: { 
      listing: 'Ajegunle House',
      check_in: { date: '9', month: 'May', year: '2016' },
      check_out: { month: 'May', date: '10', year: '2016' },
      guest_name: 'Odion',
      guest_image: 'https://a2.muscache.com/im/pictures/48f2094e-13f0-4793-b38e-5136413826ef.jpg?aki_policy=profile_medium',
      guest_message: 'Waiting',
      num_guest: '2',
      listing_url: 'https://www.airbnb.com/rooms/12896709',
      reply_to: null 
   } 
}

This library currently parses the following types of notifications:

inquiry

Parse message sent by guests. The response object content is:

{
   inquiry:{ 
      listing: 'My Home Listing',
      check_in: { date: '6', month: 'May', year: '2016' },
      check_out: { month: 'May', date: '7', year: '2016' },
      guest_name: 'Odion',
      guest_image: 'https://a2.muscache.com/im/pictures/48f2094e-13f0-4793-b38e-5136413826ef.jpg?aki_policy=profile_medium',
      guest_message: 'How is the weather in your location sir',
      num_guest: '2',
      listing_url: 'https://www.airbnb.com/rooms/12609090',
      reply_to: null 
   }
}

booking_inquiry

Parse message sent by guest about a booking reservation.

{
   booking_inquiry:{
      listing: 'Ajegunle House',
      check_in: { month: 'May', data: '07', year: '2016' },
      check_out: { month: 'June', data: '07', year: '2016' },
      guest_name: 'Angela',
      guest_image: 'https://a2.muscache.com/im/pictures/d4b0c2esjdasjdasdasdaasdd71.jpg?aki_policy=profile_x_medium',
      guest_message: 'Hi Kennedy, whats ur exact location? Looking for ...',
      num_guest: '1',
      num_nights: '31',
      reply_to: null
   }
}

pending_inquiry

Parse a pending reservation inquiry

{
   pending_inquiry:{
      guest_name: 'Odion',
      guest_image: 'https://a2.muscache.com/im/pictures/48f2094jsdiasduihusf.jpg?aki_policy=profile_x_medium',
      num_guest: '2',
      guest_city: 'Lagos, Nigeria',
      listing: 'Ajegunle House',
      check_in: { day: 'Fri', month: 'May', date: '6' },
      check_out: { day: 'Sat', month: 'May', date: '7' },
      reply_to: null
   }
}

reservation_request

Parse message about a reservation request

{
   reservation_request: {
      guest_name: 'Odion Olumhense',
      listing: 'Almost Comfortable Treehouse',
      check_in: { day: 'Tue', month: 'March', date: '01', year: '2016' },
      check_out: { day: 'Wed', month: 'March', date: '02', year: '2016' },
      num_guest: '1',
      reply_to: null
   }
}

reservation_reminder

Parse message about a reservation that has been made

{
   reservation_reminder:{
      listing: 'My Home Listing',
      check_in: { day: 'Sat', month: 'April', date: '30', year: '2016' },
      check_out: { day: 'Sun', month: 'May', date: '01', year: '2016' },
      num_guest: '1',
      listing_url: 'http://airbnb.com/roooms/82365255',
      guest_name: 'Odion Olumhense',
      guest_message: 'Hi James, This is a reminder that...',
      reply_to: null
   }
}

reservation_reply

Parse message sent by guests about a reservation request.

{
   reservation_reply: { 
      listing: 'Ajegunle House',
      check_in: { date: '9', month: 'May', year: '2016' },
      check_out: { month: 'May', date: '10', year: '2016' },
      guest_name: 'Odion',
      guest_image: 'https://a2.muscache.com/im/pictures/48f2094e-13f0dasuiuabsibs13826ef.jpg?aki_policy=profile_medium',
      guest_message: 'Waiting',
      num_guest: '2',
      listing_url: 'https://www.airbnb.com/rooms/12896709',
      reply_to: null
   } 
}

reservation_confirmed

Parse message that confirms a reservation that has been paid for.

{
   reservation_confirmed: {
      guest_name: 'Odion',
      listing: 'Ajegunle House',
      check_in: { day: 'Mon', month: 'May', date: '9' },
      check_out: { day: 'Tue', month: 'May', date: '10' },
      num_guest: '2',
      confirmation_code: 'DDYUTM',
      reply_to: null 
   }
}

reservation_canceled

Parse a reservation cancelation message

{
   reservation_canceled: { 
      confirmation_code: 'DDYUTM',
      month: 'May',
      date: '09',
      year: '2016',
      reply_to: null 
   } 
}

payout_received

Parse a payout notification message

{
   payout_received: {
      amount_paid: '$10',
      payment_method: 'PayPal',
      confirmation_code: 'PDMKQ',
      guest_name: 'Sarah Jackson',
      expected_payment_date: { date: '11', month: 'Mar', year: '2016' },
      reply_to: null
   }
}

read_review

Parse a message about reading guest reviews

{
   read_review: {
      guest_name: 'Sarah',
      public_review: 'Awesome place to stay. Would definitely recommend it. ”',
      private_review: 'Great location!”',
      reply_to: null
   }
}

write_review

Parse a message about writing a review about a guest

{
   write_review: {
      guest_name: 'Sarah',
      reply_to: null
   }
}

airbnb-parser's People

Contributors

ncodes avatar

Stargazers

 avatar  avatar  avatar Eung Jin Lee avatar eagle avatar Ayomide avatar A avatar Daniel Anthony juwon avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.