Learn to Code via Tutorials on Repl.it!

← Back to all posts
How to Make a Repl.it Cycles Notification (Apple Tutorial!!!)
h
RayhanADev (1986)

Hello people, been a while since I was last here (actually it was literally last year) but I thought I should make a proper leave. If you are interested in why, I left a small piece at the bottom about it, but without further adu:

How to Make A Repl.it Cycles Notification (Apple)

Getting Started

This is an Apple shortcut that will get information about your Repl.it Cycles with a simple tap! To start navigate to the Shortcuts App on your Apple Device.

Next up, create a new shortcut by hitting the plus button in the top-left of your screen:


Writing the Web Request

In this part, we will be getting the our cycle data from the Repl.it API. Now in your new shortcut's editor (this screen below where you drag-and-drop blocks) click into the Web tab.

In the Web tab, scroll down until you find the "Web Requests" section. When you're there, click on and add in a Get Contents of URL block.
]

Once you have added in your first block, you are ready to write the Web Request! First off, change the url in variable box to https://staging.repl.it/graphql.

Next hit the dropdown button to open up the contents of your block. We will be using the POST method (you don't really need to know how it works but Google it if interested!) to get our data so choose the POST option.

Now that we have our block in the POST method, we can write the Request Body. This contains what we are asking the API. To start, confirm that Request Body is in JSON format and then add a Text field.

Okay now we will add in all the necessary fields. Open up the Headers tab if you cannot see it already and add in the following Text fields.
Headers:
| X-Requested-With | Referrer |
| :-----: | :-----: |
| Literally Anything | https://repl.it/ |

Request Body:
| query |
| :-----: |
| { userByUsername{username: "your username in here" { karma } } } |

° Please refer to this image below if you have questions about everything's position! It may sound confusing, but a picture is worth a thousand words.

Sluicing our Variable

Great you made it this far, so give yourself a pat on the back uwu! Now it is time to get our variable out of the response. The JSON that we get in response has our cycles hidden inside, but Apple Shortcuts has no quick way to get it out. Good thing is, the method I show you is easy! Click into the Scripting tab to get started.

Once here, scroll down until you reach the "Variables" section. Then add in a Set Variable block.

Once you added your block, in the first box type data. Then pay close attention here. Click on the second box, and you should get a tab like in the image below. In that tab, click the variable format button (the "as _" button).

When clicked, scroll (up or down) until you find the "Dictionary" option. Choose the "Dictionary" Option.

After that you will be taken back to the tab. Once here click the new "Get Value for Key" button.

When you are prompted, set the value to data.

And tada! No sweat. Now you just have to repeat this two more times and that finishes the complicated part. Use these values for the rest:
| Block # | Variable Name | Value for Key |
| :-----: | :-----: | :-----: |
| 2 | userByUsername | userByUsername |
| 3 | cycles | karma |

Fun fact, the Repl.it API calls cycles karma, like Reddit! xD

Creating the Alert

Last leg of this program, you can make it! Still in the Scripting tab, scroll until you find the "Notification" section. From there, add in a Show Alert block.

Now change the box value to the "cycles" variable you previously created! If you want to, you can precede this value with Cycles: or anything you really want!

And that should be it! Test it out by clicking the Play button in the to-right corner, and you should get and alert like the one below.

And yay! If it works, you can click the three dots button at the top center. From here, you can customize how your app looks, if it is in the share sheet, and if it is on your homepage!

Congratulations!

You made your own Repl.it Cycles Notifications App, good job! If you are interested in things like this, feel free to go learn about the Repl.it GraphQL API.

About Me

So yeah, I kinda disappeared after December. Sorry ƪ(˘⌣˘)ʃ! I kinda (and still am) cramming for diagnostics, upcoming AP exams, and finals so I shifted my focus onto them for the time being. Still love the Repl.it community and miss ya'll a lot (although I can't say the same about the new redesigning...)! I'll will be back hopefully soon, but in the meantime I'm probably going to be inactive in the community. So um:


Comments
hotnewtop
FlaminHotValdez (440)

Ayy! Nice to know our resident pogfurret isn't leaving for good.

ch1ck3n (1629)

A new block coding language, yipee!

Bookie0 (5983)

It’s pretty cool, but why would you want to get updates when you get more cycles? Notifications, I would understand, but useless internet points?

I knew the good thing is you use Apple! :)

RayhanADev (1986)

@Bookie0 :D well not updates (I'd hate that xd) just a clickable to see how much you have!

Bookie0 (5983)

@RayhanADev oh ok not updates lol, but i mean you could just log on to repl.it to find the number of cycles (not that you'd need to) :)

ItamarCohen28 (10)

I saw your ric-roll on how to use markdown :)

@Bookie0

FloCal35 (497)

Ew light mode

My eyeeeeeeeees

RayhanADev (1986)

@FloCal35 sowwy, also when did Repl.it get Dark Theme (^ヮ^)/

Kookiez (389)

@RayhanADev It's probably an explorer thing, if you dare to want light mode, I think you have to disable explorer

FloCal35 (497)

Ikr @RayhanADev, they updated it recently (actually right before I saw this post)

FlaminHotValdez (440)

@RayhanADev enable explorer mode. It's only available to explorers, but anybody can become an explorers, go to edit your profile, roles, then click the box next to explorer to enable it.

Whippingdot (567)

Wait what. Dark mode is there. MY EYES. WHEN DID THAT HAPPEN. WHY AM I USING TAMPERMONKEY YOU * WHY DID YOU TRICK ME @FlaminHotValdez

Whippingdot (567)

I LOVE DARK MODE ♥♥♥♥♥♥♥♥♥ but I think my own css might be better @FlaminHotValdez

Whippingdot (567)

Na I think dark mode is better. I will have my css in the morning and after 3 it is dark mode time @FlaminHotValdez

Crosis (277)

@RayhanADev How would I do this in NodeJS?

RayhanADev (1986)

@FlaminHotValdez I'm already an explorer, that's why i asked (⁄ ⁄>⁄ ▽ ⁄<⁄ ⁄)

RayhanADev (1986)

@Crosis hmmm, prolly go through my older tutorials till you find the GraphQL tutorials I made!

Crosis (277)

@RayhanADev Also, you should update the link in the tutorials from https://repl.it/graphql to https://staging.repl.it/graphql as I am pretty sure it is not working with the first one

Whippingdot (567)

U seem to be ignoring me 😭😭 @RayhanADev

Crosis (277)

@RayhanADev Sorry for ping, but Repl just added always on repls! and thanks for the info, with your help I was able to add cycles to my chat! Tysm!

Whippingdot (567)

Wait a sec when did they add always on repls. I don't see it in the pricing. It still says coming soon @Crosis

FlaminHotValdez (440)

@Whippingdot bruh it literally came out yesterday don't kill me

Whippingdot (567)

But where does it say that and how do you know? @FlaminHotValdez

FlaminHotValdez (440)

@Whippingdot because there were a bunch of ask posts saying Why isn't this working with dark mode on and I'm like say what?

Whippingdot (567)

I know dark mode is on, I asked how do you know always on repls are there @FlaminHotValdez

FlaminHotValdez (440)

@Whippingdot I don't know I don't have hacker

Whippingdot (567)

uuu i invite you to repl and give you code tomorrow?(IT IS FREAKING 11 FOR ME MY PARENTS ARE GOING TO MURDER ME I ALSO HAVE A FREAKING EXAM) @FlaminHotValdez

Whippingdot (567)

I was in my bed by then 😁 @FlaminHotValdez

Whippingdot (567)

Now I woke up feeling great drinking holy water - Lil Mosey in the song 'Holy Water' @FlaminHotValdez

Whippingdot (567)

oke doke really sorry but @amasad I don't know who to ping as moderation doesn't work. the pricing page on repl.it still says coming soon for always on repls so I think you should change it @Crosis

ch1ck3n (1629)

I tried to use it with python and this happened:
POST body missing. Did you forget use body-parser middleware?

this is my code

import requests
import json

url = 'https://staging.repl.it/graphql'
payload = {'query': '{ userByUsername{username: "ch1ck3n" { karma } } }'}
headers = {'X-Requested-With': 'My stupid script', 'Referrer': "https://repl.it/"}

r = requests.post(url, data=json.dumps(payload), headers=headers)

print(r.text)
Chewyblockguy (9)

oh wow this seems easy enough. 5 hours later how the heck do I do this!!! lol

PYer (3787)

Uh I'm pretty confident I created a post like this before you. And then this gets in the newsletter... :| However, it is different + shorter, so great job still

RayhanADev (1986)

@PYer oop yeah I just saw yours xD (I like how yours allows users to look up anyone :D)

FloCal35 (497)

Congrats on your Repl.it newsletter mention. This is still not working for me even though I've done everything it said

DungeonMaster00 (183)

but Google it if interested

no search it on duckduckgo instead

RayhanADev (1986)

FYI

if it says something like

Cycles:

when you run this, then change the url from https://staging.repl.it/graphql to https://repl.it/graphql

zplusfour (890)

rip android users ;-;

RayhanADev (1986)

@zplusfour yes sorry xD I'm sure there is something for Android i don't know ƪ(˘⌣˘)ʃ

Whippingdot (567)

NOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO Y U LEAVE YOU WERE MY FIRST FRIEND ON REPL.IT, YOU INTRODUCED ME TO @TsunamiOrSumth, and you joined one month before me. EXACTLY. WHYYYYYYYYYYYY GOD WHYYYYY BTW do you want to join the org for repl.it coders? I know you are leaving but...

Whippingdot (567)

I shud ask that q to you @angrydoge

Whippingdot (567)

Again, i shud ask that question to you @angrydoge

Whippingdot (567)

I SAID YOOOOOUUUUUUUUUUUUU @angrydoge

Whippingdot (567)
i am pettty suuur u...but maybe @angrydoge
angrydoge (476)

Ight im coding so no pong plz. @RayhanADev

Whippingdot (567)

WHY CAN'T I PLAY PONG STOP SAYING NO PONG PLZ @angrydoge

I SAID U ALREADY UUUUUUUUGGGGGGHHHHHH!! @angrydoge


@RayanADev YAAAAAAAAAAAAAAAAAAAAAA

angrydoge (476)

YOU JUST PINGED ME THREE TIMES STOP @Whippingdot

Whippingdot (567)

Shud i reply to this...or no
😁 @angrydoge

FlaminHotValdez (440)

@Whippingdot Check out my comment he's only temporarily leaving until his exams/APs are over(thankfully). If he were really leaving I'm 99.9% sure the community would throw a GOODBYE RAY party lol

Whippingdot (567)

Oh yea just realized. Also grining his teeth together RAY YOU TRICK MEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE @FlaminHotValdez

FlaminHotValdez (440)

@Whippingdot he didn't...at the bottom he explains. Also go to bed it's like 10 pm for you right

Whippingdot (567)

how do you know also i have a math exam tomorrow 😁😁😁 i am preparing for it and checking this once in 10 mins @FlaminHotValdez

FlaminHotValdez (440)

@Whippingdot xD you're in IST time which is more or less 13 hours ahead of me, and then it was around 8 30 so I roughguessed

RayhanADev (1986)

@RhinoRunner hmmm, can you show me your wWeb Request block?

Whippingdot (567)

Oh, that is because you aren't exercising. GO CYCLE @RhinoRunner

RayhanADev (1986)

@JBYT27 hrmmm weird lemme check something in the tutorial then.

RhinoRunner (792)

@Whippingdot boi i have more cycle than you
OK, will do

Whippingdot (567)

I only have 1 cycle i guess. How many bicyles can a man have? @RhinoRunner

RhinoRunner (792)

@Whippingdot oh you mean bikes
i have .9 of them

IntellectualGuy (690)

Me: cries in no iphone
Make a tutorials for windows please

programmeruser (576)

@IntellectualGuy you can probably create something with HTML/CSS/JS or IFTTT

IntellectualGuy (690)

@programmeruser What's IFTTT? And how would I use HTML/CSS/JS for it?

programmeruser (576)

@IntellectualGuy create a proxy tat sets the right headers, and use the Notification API. IFTTT

IntellectualGuy (690)

@programmeruser I know like 0 JavaScript, so I probably won't be able to do that.

Coder100 (17018)

cool!
but why staging subdomain?

RayhanADev (1986)

@Coder100 so that the https://repl.it/graphql page doesn't die when someone spams it. Staging is kinda like what you use for everything non-user related imo.

programmeruser (576)

@RayhanADev it's possible to bypass cloudflare

RayhanADev (1986)

@programmeruser exsqueze me wha? explain pls <(_ _*)>

Kookiez (389)

@RayhanADev Nah, only iPhones and iPads are ok, but Macs aren't good

xxpertHacker (861)

@Kookiez Honestly, I hate how restricted iPhones are, I can't execute unsigned native, executable, code on RAM. Also, they're fairly useless without being jailbroken.

RayhanADev (1986)

@Kookiez @tussiez yep, agreed. Also Airpods aren't tooo bad (but those Maxes though smh)
@xxpertHacker well yeah, but for someone who uses an iPhoen for everything besides that, it does more than well :D

tussiez (1515)

@RayhanADev
I can't afford any of their products -_(..)/-

tussiez (1515)

@RayhanADev @Kookiez
There is one thing they do well: profit

xxpertHacker (861)

@RayhanADev Okay, Airpods are good, their tech like that is good, but anything that runs on their own OS (e.g. iPhone, MacOS), I dislike.

...for everything besides that...

For what?

FloCal35 (497)

@Kookiez Bookie0 won't be happy you don't like macs (I won't ping him)

IntellectualGuy (690)

@FloCal35 Lol I was about to say the same thing

programmeruser (576)

@RayhanADev they won't even let you access the filesystem.
You can't do anything without a jailbreak.

RayhanADev (1986)

@programmeruser yea, but I really don't plan on jailbreaking any Apple devices, it's kinda pointless to mess with a phone?

FlaminHotValdez (440)

@RayhanADev I know this is a dead thread but my name is Max(I changed my username from @maxyang to @FlaminHotValdez) bc it showed my real name...

me is insulted