Items used in this project
Now that we know how to get notifications in our devices (don't remember? look here), we can learn how to share these notifications with other people.
Why would we want to do that? Well, there are different cases where this could be convenient.
Example 1: you built your first garage door opener with a Particle dev kit and you can receive a notification on your phone if the door is closed. Fine, this is great.
Now what happens when you want your wife, your kids, even a friend to receive this info in their phone?
Example 2: You retrofitted your washer machine and it sends you a notification when the cycle is over. Great! Now what happens if it wasn't you who started it?
What could be better than getting push notifications in your devices?
To get them and not have them pile up in a long list, which clutters the notification area of your phone.
Let's compare side by side what we get:
On the left, we have the regular notifications. On the right, we have the channel notifications.
Seven notifications took the same screen space as only two regular notifications. Also, for dismissing them is much easier. Instead of having to dismiss one by one you can dismiss them all as a block.
So now, which one do you prefer? Channels? Yeah, me too.
Enough of intro, let's jump now into setting things up...
One easy way of scaling this mechanism of push notifications to other people is by creating a channel in Pushbullet.
Users can create their own channels and let other people subscribe to them. So when your hardware of choice sends a notification to this channel, everybody gets it.
NOTE: there are no private channels in Pushbullet. So in order to prevent your washing cycles to go viral share your channels only with the people that matters.
Head to this page and create your first channel. Since all channels are public, we want to enter a very weird string in the #tag field so nobody can guess it.
Now give it a name and a description, then hit the Create Channel button.
We need to add the following line of code in the particle's firmware:Particle.publish("hacksterchannel", "Your socks are washed", 60, PRIVATE);
NOTE: Remember to check my original article about pushbullet notifications here for more details.
Download to your computer the webhook code (find it in the software section below) in a file named webhookchannel.json.
Edit the webhookchannel.json file just downloaded and replace the Access Token in the Bearer field (you have to replace 123456789012345678901234567890 with your Pushbullet Access Token). Also, replace the #tag of the channel with your own #tag (replace hacksterArticle123456789 with the weird string you chose for the channel tag). Save and close the file.
Once the file is edited with the token and the channel tag, you are ready to upload this webhook to the Particle cloud.
Open a console and type:particle webhook create webhookchannel.json
You hit enter and beg to find in the output of the command the following:Successfully created webhook with ID 1234kljhl123h41234jklh
That means the webhook got configured correctly.
Surely, they need to have their own pushbullet account. Now:
- send them the #tag
- let them go to the Following section of the settings page on the pushbullet site (I don't know if this can be done from the app itself)
- enter the #tag on the search field on top
- hopefully only your channel comes up in the search
- click on it to subscribe
Now every time your Particle dev kit (or your particular hardware, if you are not using one) triggers a notification that goes in the channel, all subscribers to the channel get it.
- IFTTT Maker Channel: if you are using the maker channel your hardware is already set. Just make your recipes use the pushbullet channel and you are ready to go.
- Raspberry pi and other hardware: if your hardware supports an http client, you can send a REST request to the pushbullet API and you will be able to receive notifications in your devices. And if your hardware is already using the IFTTT maker channel, see previous bullet.
Hope you liked it!
Feel free to visit my projects to get real examples on how you can use this mechanism.
Psst: please find my other projects here.
If you require professional help with your projects, don't hesitate to write me a line about your needs at email@example.com. Thank you!