{"id":13524976,"url":"https://github.com/miguelToscano/w3ns","last_synced_at":"2025-04-01T04:30:37.564Z","repository":{"id":182351107,"uuid":"649634871","full_name":"miguelToscano/w3ns","owner":"miguelToscano","description":null,"archived":false,"fork":false,"pushed_at":"2023-08-10T00:12:34.000Z","size":13258,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-08-02T06:17:11.424Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/miguelToscano.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-06-05T09:59:14.000Z","updated_at":"2024-06-10T14:17:29.000Z","dependencies_parsed_at":"2024-01-13T22:48:29.168Z","dependency_job_id":"b88eb434-8b49-4024-aa4b-38662642fec1","html_url":"https://github.com/miguelToscano/w3ns","commit_stats":null,"previous_names":["migueltoscano/w3ns"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miguelToscano%2Fw3ns","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miguelToscano%2Fw3ns/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miguelToscano%2Fw3ns/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miguelToscano%2Fw3ns/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/miguelToscano","download_url":"https://codeload.github.com/miguelToscano/w3ns/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222698192,"owners_count":17024878,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T06:01:15.070Z","updated_at":"2024-11-02T09:30:39.370Z","avatar_url":"https://github.com/miguelToscano.png","language":"Rust","funding_links":[],"categories":["Messaging"],"sub_categories":["Analytical Methodologies"],"readme":"# W3NS\nAn Internet Computer service for notifications\n\n# Getting an API key\nWe use Courier notifications API in order to integrate with different providers.\n\n- Create an account in https://www.courier.com/\n- Sign in\n- Go to Settings \u003e API Keys\n- Generate New API key\n\n# Register your API Key\nNow you need to register your API key in order to let W3NS send notifications on your behalf\n\n`dfx canister --wallet=\u003cYOUR_WALLET_PRINCIPAL_ID\u003e call w3ns register_key \"(\\\"\u003cYOUR_COURIER_API_KEY\u003e\\\")\"`\n\n# Courier Channels setup\nW3NS currently supports 3 notifications channels:\n\n- `Gmail` for emails \n- `Twilio` for SMS\n- `Firebase FCM` for push\n\nTo set up a Courier Channel:\n\n- Sign in to https://www.courier.com/\n- Go to Channels \u003e Add Channel\n- Follow the steps for each of the providers that W3NS supports (Gmail, Twilio, Firebase FCM)\n\n# Sending notifications\nFor the following steps to work you should already have your Courier's API key registered as well as the Courier's providers configured.\nEach notification sending method requires a 4000000000 cycles payment in order to cover for cycles consumed.\n## Send email\nYou can send emails via W3NS by running:\n\n`dfx canister --wallet=\u003cYOUR_WALLET_PRINCIPAL_ID\u003e call --with-cycles=4000000000 w3ns send_email \"(record { to=\\\"\u003cEMAIL\u003e\\\"; subject=\\\"\u003cSUBJECT\u003e\\\"; body=\\\"\u003cBODY\u003e\\\" })\"`\n\n## Send SMS\nYou can send SMS via W3NS by running\n\n`dfx canister --wallet=\u003cYOUR_WALLET_PRINCIPAL_ID\u003e call --with-cycles=4000000000 w3ns send_sms \"(record { to=\\\"\u003cPHONE_NUMBER\u003e\\\";     message=\\\"\u003cMESSAGE\u003e\\\" })\"`\n\n## Send Push\nYou can send Push notifications via W3NS by running\n\n`dfx canister --wallet=\u003cYOUR_WALLET_PRINCIPAL_ID\u003e call --with-cycles=4000000000 w3ns send_push \"(record { to=\\\"\u003cFIREBASE_TOKEN\u003e\\\"; title=\\\"\u003cSUBJECT\u003e\\\"; body=\\\"\u003cBODY\u003e\\\" })\"`\n\n## Send push to topic\nTo send a push notifcations to users subscribed to a certain topic first you have to create it and subscribe users to it\n\n### Create a topic\n`dfx canister --wallet=\u003cYOUR_WALLET_PRINCIPAL_ID\u003e call w3ns create_topic \"(\\\"\u003cYOUR_TOPIC_NAME\u003e\\\")\"`\n\n### Subscribe a user to a topic\n`dfx canister --wallet=\u003cYOUR_WALLET_PRINCIPAL_ID\u003e call w3ns subscribe_user_to_topic \"(record { topic=\\\"\u003cYOUR_TOPIC_NAME\u003e\\\"; registration_token=\\\"\u003cUSERS_FIREBASE_TOKEN\u003e\\\" })\"`\n\n### Send push notification to users subscribed to a topic\n`dfx canister --wallet=\u003cYOUR_WALLET_PRINCIPAL_ID\u003e call --with-cycles=4000000000 w3ns send_push_to_topic \"(record { title=\\\"\u003cTITLE\u003e\\\"; body=\\\"\u003cBODY\u003e\\\"; topic=\\\"\u003cTOPIC_NAME\u003e\\\" })\"`\n\n### Unsubscribe user from a topic\n`dfx canister --wallet=\u003cYOUR_WALLET_PRINCIPAL_ID\u003e call w3ns unsubscribe_user_from_topic \"(record { topic=\\\"\u003cYOUR_TOPIC_NAME\u003e\\\"; registration_token=\\\"\u003cUSERS_FIREBASE_TOKEN\u003e\\\" })\"`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FmiguelToscano%2Fw3ns","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FmiguelToscano%2Fw3ns","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FmiguelToscano%2Fw3ns/lists"}