Sleep Schedule Generator for Babies with Intercom API Integration
Our client needed a Sleep Schedule Generator for babies. They sell baby monitors, so it was a nice feature to have on their website. They needed this for anxious parents who are not sure when to take their baby to sleep, or when to feed him. Our client discussed this problem with pediatricians and found out a chart of an ideal sleep schedule. We were asked to convert this chart into a WordPress plugin.
Our task mainly was to:
- Create a Custom Post Type for Sleep Schedule
- Make some particular style permalinks for these Sleep Schedules
- Facilitate to add and edit events in the Sleep Schedule
- Update the sleep schedule based on when the baby wakes up
- Implement a newsletter service that works with the Intercom API
- Make all the designs, including the sleep schedules responsive-enabled
We had a good time creating the plugin because the specs was clear, the blueprint was already made. We just had to integrate the plan into WordPress.
Here’s how we solved the problem:
Custom Post Type
As soon as our plugin is installed, it creates a Custom Post Type named “Sleep Generator”. We have placed settings on the CPT page so that Admin can create Sleep Generators for certain ages and add, edit events in the schedule accordingly. He can also attach a post body into the schedule which will help the parent even more with helpful tips.
Landing Page Form
We created a shortcode for the landing page. This shortcode shows the form that lets the user enter his name, email and baby’s birthdate. It goes to the appropriate sleep schedule based on the birthdate selected. It also has a checkbox to subscribe the user to Intercom-powered Newsletter.
Sleep Generator Page
The page is unique of its kind that we worked on. It has a slider to set the wake up time and “events” to show the various points in the schedules. When the slider is changed, we programmed the events to adopt to the wake up time and update the whole sleep schedule automatically. The Admin just needs to make sure he has created the events properly in the CPT.
Newsletter with Intercom
We have a subscribe form in the Sleep Schedule page. It respects the input of the user previously entered in the landing page form. The user just needs to click a button to get subscribed (if not chosen earlier).
The whole design was to be made usable on mobile devices. So we had to plan accordingly. We have designed the interface and used a proper slider library so that it can be usable in a tiny screen.
Putting it all together
Our plugin combines all these items together into a nice plugin that works seemlessly with WordPress and Intercom API and lets you create a very useful Sleep Schedule Generator for your website. Brings an interface to it and adopts it to screens and settings with pediatrically correct data.
It was a great project and we had fun developing it.