Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/miguelToscano/w3ns


https://github.com/miguelToscano/w3ns

Last synced: 5 days ago
JSON representation

Awesome Lists containing this project

README

        

# W3NS
An Internet Computer service for notifications

# Getting an API key
We use Courier notifications API in order to integrate with different providers.

- Create an account in https://www.courier.com/
- Sign in
- Go to Settings > API Keys
- Generate New API key

# Register your API Key
Now you need to register your API key in order to let W3NS send notifications on your behalf

`dfx canister --wallet= call w3ns register_key "(\"\")"`

# Courier Channels setup
W3NS currently supports 3 notifications channels:

- `Gmail` for emails
- `Twilio` for SMS
- `Firebase FCM` for push

To set up a Courier Channel:

- Sign in to https://www.courier.com/
- Go to Channels > Add Channel
- Follow the steps for each of the providers that W3NS supports (Gmail, Twilio, Firebase FCM)

# Sending notifications
For the following steps to work you should already have your Courier's API key registered as well as the Courier's providers configured.
Each notification sending method requires a 4000000000 cycles payment in order to cover for cycles consumed.
## Send email
You can send emails via W3NS by running:

`dfx canister --wallet= call --with-cycles=4000000000 w3ns send_email "(record { to=\"\"; subject=\"\"; body=\"\" })"`

## Send SMS
You can send SMS via W3NS by running

`dfx canister --wallet= call --with-cycles=4000000000 w3ns send_sms "(record { to=\"\"; message=\"\" })"`

## Send Push
You can send Push notifications via W3NS by running

`dfx canister --wallet= call --with-cycles=4000000000 w3ns send_push "(record { to=\"\"; title=\"\"; body=\"\" })"`

## Send push to topic
To send a push notifcations to users subscribed to a certain topic first you have to create it and subscribe users to it

### Create a topic
`dfx canister --wallet= call w3ns create_topic "(\"\")"`

### Subscribe a user to a topic
`dfx canister --wallet= call w3ns subscribe_user_to_topic "(record { topic=\"\"; registration_token=\"\" })"`

### Send push notification to users subscribed to a topic
`dfx canister --wallet= call --with-cycles=4000000000 w3ns send_push_to_topic "(record { title=\"\"; body=\"\"; topic=\"\" })"`

### Unsubscribe user from a topic
`dfx canister --wallet= call w3ns unsubscribe_user_from_topic "(record { topic=\"\"; registration_token=\"\" })"`