GithubHelp home page GithubHelp logo

dayschedule / dayschedule-api Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 2.0 159 KB

Official Node.js library for DaySchedule to integrate online appointments bookings, reservation and calendar scheduling via API

Home Page: https://dayschedule.com/docs/api

License: MIT License

TypeScript 100.00%
calendly scheduling appointment-api appointment-scheduler appointments bookings calendar reservation

dayschedule-api's Introduction

dayschedule

version license

Official Node.js library for DaySchedule API to integrate online appointments bookings, reservation and calendar scheduling in any tool with embeddable widget on front-end and this SDK on backend for complete white-label appointment scheduling at any scale.

Installation

npm i dayschedule-api

Documentation

Full API documentation to understand the appointment booking flow with DaySchedule is available at - https://dayschedule.com/docs/api

Getting started

Create a DaySchedule instance with api key. You can get your api keys from the app https://app.dayschedule.com/settings/apikeys

const DaySchedule = require('dayschedule-api');

const daySchedule = new DaySchedule('YOUR_API_KEY');

The SDK is UMD (Universal Module Definition) compatible, which means that it can be loaded in various module formats.

ES6 module

import DaySchedule from 'dayschedule-api'
const daySchedule = new DaySchedule('YOUR_API_KEY');

CommonJS2 (in e.g. node.js)

const DaySchedule = require('dayschedule-api');
const daySchedule = new DaySchedule('YOUR_API_KEY');

Now, the API can be accessed via the daySchedule instance. All the methods follow the namespaced signature. For example, to fetch all the booked appointments -

// API signature
// {daySchedule}.{api}.{method}(id, [params])

// example
const bookings = await daySchedule.bookings.list();

Every request returns a promise.

Methods

Each API endpoint has these 5 methods list, get, create, update, delete API operations. For example, here is the booking API methods -

Method Description Parameters Return Value
list Get all the bookings params: any Promise<Bookings[]>
get Get details of a booking by ID id: string Promise<Bookings>
create Create a new booking data: any Promise<Bookings>
update Update an existing booking by ID id: string, data: any Promise<Bookings>
delete Delete a booking by ID id: string Promise<any>

Booking example:

// Using promises
daySchedule.bookings.create({
    "resource":{
        "resource_id":"643d0e3511ce9450e585c2a9",
    },
    "host":{
        "user_id":758
    },
    "start_at":"2023-10-11T09:00:00.000Z",
    "end_at":"2023-10-11T09:30:00.000Z",
    "invitees":[{
        "name":"John Doe",
        "email":"[email protected]"
        "questions":[
            {
                "type":"text",
                "name":"age",
                "label":"What is your age?",
                "value":"18"
             },
         ]}
    ]
}).then(function(response){
  console.log(response);
}).catch(function(response){
  console.log(response);
});

// Using async/await
const response = await daySchedule.bookings.create({ ... })

More examples

Release

  1. Switch to main branch.
  2. Update the CHANGELOG.md & bump the version in package.json
  3. Commit and Tag the release & push to Github
  4. Create a release on GitHub with changelog
  5. Publish to npm with npm publish command

License

MIT Licensed. See LICENSE.txt for more details

dayschedule-api's People

Contributors

jainshubh0612 avatar vickyrathee avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

botmasterza re8an

dayschedule-api's Issues

Provide more details on how to use 'filter' and 'search' query parameters in fetching bookings

I am developing an application using dayschedule's api and from the api docs, it isn't obvious as to how to specify 'filter' and 'search'. I would like to fetch all bookings with a 'resource_id', an example will be {{BASE_URL}}/bookings?apiKey={{API_KEY}}&resource_id=<resource_id>, but it seems that I would need to specific {{BASE_URL}}/bookings?apiKey={{API_KEY}}&filter=<resource_id> or similar.

Please clarify how to use 'filter' and 'search', and what fields are supported. Thanks!

Add 'invitees' into response on fetching bookings

Currently the response from /bookings?resource_id=<resource_id> does not include the invitees field. As a work around, I have to call /bookings/<booking_id> on each booking to get the invitees information. The reason I need the invitees information is so that I can customize the rendering of bookings in my app, and currently the invitee's name is only in the 'subject' text in /bookings?resource_id=<resource_id> response.

Book an appointment on mobile browsers with the inline popup widget seems to hang after clicking on the 'Confirm booking' button

I added an inline popup in a web page for a service resource, and it works fine if the site visitor books an appointment from a desktop browser (Chrome,Safari or Firefox). However it seems to hang after clicking on the 'Confirm booking' on a mobile browser as it just shows a spinner (mobile Chrome, Safari). To see the issue, on a mobile browser, go to https://sohairdesign.lumosworks.com and click on the 'Book An Appointment' link. See picture below:
Screenshot 2023-12-04 at 9 21 24 AM

Screenshot 2023-12-04 at 9 24 15 AM

P.S. The button now says 'Confirm booking' if no payment gateway is setup. Yay.

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.