Skip to content

smiirl/smiirl-custom-samples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Smiirl Custom Counter Documentation & Samples

Welcome to the Smiirl Custom Counter official documentation 🥁

In case you missed it: this incredible piece of hardware can display any figure in real time! It's a great way to stay connected to the figures that matter most to you or your business.

The Counter can display data parsed into a JSON webpage or waits for external calls to update its number. It therefore requires a bit of technical know-how.

The objective of this repo is to help developers understand the ins and outs of connecting your data to a Custom Counter.

We feature explanations and real-life code for use cases with services such as YouTube or Facebook Ads; obviously free to use for your own application!

CU_Batch3_Statique_Classique_1

Before we get started

This doc assumes that you can host your code online. If not, you should follow this step-by-step tutorial for PHP by Heroku.

Packages

To get started, you may want to install the following packages. They help you transfer your data to the Counter with 1 line of code.

PHP + Composer

We have it in PHP: https://packagist.org/packages/smiirl/smiirl-library-php

Node + Npm

And in JavaScript: https://www.npmjs.com/package/@smiirl/smiirl-library-js

Prestashop module

You can install it in your Prestashop back office to display your sales data in real time. https://github.com/smiirl/prestashop-module

See link below to samples for YouTube or Facebook Ads.

Counter Connection Options

There are 2 ways to connect a number to a Smiirl Custom Counter:

  • JSON URL
  • PUSH NUMBER.

For JSON URL, the counter is active and will call an external url at regular time intervals (chosen on the settings of the counter under REACTIVITY).

For PUSH NUMBER, the counter is passive and waits for external calls to update its number.

First choose the most adapted way for your application and follow the corresponding section.

JSON URL

The main configuration steps:

  1. Configure your code file based on your project's specificity. Check out examples here: JSON URL.

  2. Host your code on your server under your own url "http://mycounterproject.mybusiness.com".

    • Send a response with the 'Content-type' application/json
    • It should contain something like
    {
        "number": 42
    }
  3. In https://my.smiirl.com:

    • Go to the Settings of your counter.
    • Change its options to JSON URL.
    • Set the url with the one exposed in step 1.
    • If applicable, choose the attribute you want to show if your json has several ones.
    • If applicable, customize the polling interval (reactivity).
    • Save your settings.

PUSH NUMBER

In https://my.smiirl.com:

  • Go to the Settings of your counter.
  • Change its options to "PUSH NUMBER".
  • Collect the CURL Endpoint of your counter; it should look like http://api.smiirl.com/YOU_MAC/set-number/YOUR_TOKEN/YOUR_NUMBER.
  • Request this url in your code (GET).
  • Execute your code.

Concrete Examples

Click the sections below to review the code for simple and more real-life projects 🤓

Next steps together

You love the Counter and would like to contribute? Pull Requests welcome 😍

What other services would you like to see documented here? Please email us to partnership@smiirl.com. We would love to hear from you ❤️

About

Some examples of apis for the custom counter

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published