Code Monkey home page Code Monkey logo

us-visa-appointment-notifier's Introduction

US-visa-appointment-notifier

This is just a script I put together to check and notify me via email (MailGun) when there's an earlier date before my initial appointment date. It doesn't handle rescheduling.

$ npm start
=====>>> Step: starting process with 250 tries left
=====>>> Step: logging in
=====>>> Step: checking for schedules
[{"date":"2023-02-08","business_day":true},{"date":"2023-04-26","business_day":true},{"date":"2023-10-11","business_day":true}]
=====>>> Step: starting process with 249 tries left
=====>>> Step: checking for schedules
[{"date":"2023-04-26","business_day":true},{"date":"2023-10-11","business_day":true}]
=====>>> Step: starting process with 248 tries left
=====>>> Step: checking for schedules
[{"date":"2023-10-11","business_day":true}]
=====>>> Step: sending an email to schedule for 2023-10-11
...

email notification sample

How it works

  • Logs you into the portal
  • checks for schedules by day
  • If there's a date before your initial appointment, it notifies you via email
  • If no dates found, the process waits for set amount of seconds to cool down before restarting and will stop when it reaches the set max retries.

see config.js or .env.example for values you can configure

Configuration

copy the example configuration file exampe in .env.example, rename the copied version to .env and replace the values.

MailGun config values

You can create a free account with https://www.mailgun.com/ which should be sufficient and use the provided sandbox domain on your dashboard. The MAILGUN_API_KEY can be found in your Mailgun dashboard, it starts with key-xxxxxx. You'll need to add authorised recipients to your sandbox domain for free accounts

FAQ

  • How do I get my facility ID - #3
  • How do I get my schedule ID - #8, #7 (comment)
  • How to setup Mailgun Authorised recipients - #5

How to use it

  • clone the repo
  • run npm i within the cloned repo directory
  • start the process with npm start

us-visa-appointment-notifier's People

Contributors

aliidrees avatar theoomoregbee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

us-visa-appointment-notifier's Issues

Error in npm i run

getting below and nothing is happening after that:
$ npm i
npm WARN old lockfile
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile

MAILGUN_DOMAIN='mailgun domain' what will be the domain

I saw your config file[https://github.com/theoomoregbee/US-visa-appointment-notifier/blob/main/.env.example] line-15 asking for MAILGUN_DOMAIN='mailgun domain' but I dont know what value i put it there from the below mailgun info I have...

My mailgun account gave me the following:

`curl -s --user 'api:b84a-72f'
https://api.mailgun.net/v3/sandbox37****************22.mailgun.org/messages
-F from='Mailgun Sandbox <postmaster@sandbox37
**22.mailgun.org>'
-F to='Sam **@outlook.com'
-F subject='Hello Sam'
-F text='Congratulations Sam, you just sent an email with Mailgun! You are truly awesome!'

Your guidance will be appreciated. Thank you in advance

Error: Parameter "key" is required

Hello, i am having this error when i run 'npm start':

Error: Parameter "key" is required
at new _ (/Users/xxx/Desktop/US-visa-appointment-notifier-main/node_modules/mailgun.js/mailgun.node.js:2:32862)
at e.client (/Users/xxx/Desktop/US-visa-appointment-notifier-main/node_modules/mailgun.js/mailgun.node.js:2:58416)
at Object. (/Users/xxx/Desktop/US-visa-appointment-notifier-main/utils.js:6:20)
at Module._compile (node:internal/modules/cjs/loader:1376:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
at Module.load (node:internal/modules/cjs/loader:1207:32)
at Module._load (node:internal/modules/cjs/loader:1023:12)
at Module.require (node:internal/modules/cjs/loader:1235:19)
at require (node:internal/modules/helpers:176:18)
at Object. (/Users/xxx/Desktop/US-visa-appointment-notifier-main/index.js:5:37)

My env is setting as:
NOTIFY_EMAILS='[email protected]'
MAILGUN_USERNAME='[email protected]'
MAILGUN_DOMAIN='sandboxaxxxx.mailgun.org'
MAILGUN_API_KEY='pubkey-xxxx'

Browsing other solution but still doesn't help :(

Error: Parameter "key" is required

Error: Parameter "key" is required
at new _ (C:\US-visa-appointment-notifier-main\node_modules\mailgun.js\mailgun.node.js:2:32862)
at e.client (C:\US-visa-appointment-notifier-main\node_modules\mailgun.js\mailgun.node.js:2:58416)
at Object. (C:\US-visa-appointment-notifier-main\utils.js:6:20)
at Module._compile (node:internal/modules/cjs/loader:1226:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1280:10)
at Module.load (node:internal/modules/cjs/loader:1089:32)
at Module._load (node:internal/modules/cjs/loader:930:12)
at Module.require (node:internal/modules/cjs/loader:1113:19)
at require (node:internal/modules/cjs/helpers:103:18)
at Object. (C:\US-visa-appointment-notifier-main\index.js:4:37)

Appreciate if anyone can assist on priority pls.

Unable to parse page JSON content

Hello.

I am encountering an error like this. What's the solution?
I need help urgently.
puppeteer version: 19.8.5

npm start

[email protected] start
node index.js

=====>>> Step: starting process with 250 tries left
=====>>> Step: logging in
=====>>> Step: checking for schedules

Unable to parse page JSON content
SyntaxError: Unexpected end of JSON input
at JSON.parse ()
at checkForSchedules (C:\Users\Alex92\Desktop\Visa\index.js:52:30)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async process (C:\Users\Alex92\Desktop\Visa\index.js:84:24)
at async C:\Users\Alex92\Desktop\Visa\index.js:99:5

Error 404 for send mail

Hi,

I'm getting the below error while the app sends out an email. I have used the same parameter and key values using postman and it worked.

=====>>> Step: sending an email to schedule for 31-01-2024
[Error: Not Found] { status: 404, details: '404 page not found\n' }

npm start with an error

npm start not working with below error:

root@ubuntu-22:~/USvisa/US-visa-appointment-notifier# npm start

> [email protected] start
> node index.js

(node:16687) UnhandledPromiseRejectionWarning: Error: Failed to launch the browser process!
[0312/043410.440449:ERROR:zygote_host_impl_linux.cc(90)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.

TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md
    at onClose (/root/USvisa/US-visa-appointment-notifier/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:290:20)
    at Interface.<anonymous> (/root/USvisa/US-visa-appointment-notifier/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:278:24)
    at Interface.emit (events.js:326:22)
    at Interface.close (readline.js:416:8)
    at Socket.onend (readline.js:194:10)
    at Socket.emit (events.js:326:22)
    at endReadableNT (_stream_readable.js:1241:12)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)

(node:16687) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)

(node:16687) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Error when sending email

When the code reaches the sending email part, I get this error: [Error: Not Found] { status: 404, details: '404 page not found\n' }. I think this is either the mailgun domain or the API key, I'm taking both from mailgun control panel>sending>overview "API-key" and "API base URL" fields

proxy settings

Can you do the proxy settings for this script? I searched for Puppeteer but it always gave an error.

Error: Cannot find module 'puppeteer'

Error: Cannot find module 'puppeteer'
Require stack:

  • /Users/apple/Desktop/US-visa-appointment-notifier-main/index.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:995:15)
    at Function.Module._load (node:internal/modules/cjs/loader:841:27)
    at Module.require (node:internal/modules/cjs/loader:1067:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at Object. (/Users/apple/Desktop/US-visa-appointment-notifier-main/index.js:1:19)
    at Module._compile (node:internal/modules/cjs/loader:1165:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1219:10)
    at Module.load (node:internal/modules/cjs/loader:1043:32)
    at Function.Module._load (node:internal/modules/cjs/loader:878:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) {
    code: 'MODULE_NOT_FOUND',

Authorized Recipients

"status: 403,
details: 'Domain sandboxe1164ceef2a340a89c348279b0dde46b.mailgun.org is not allowed to send: Sandbox subdomains are for test purposes only. Please add your own domain or add the address to authorized recipients in Account Settings.' "

I added the authorized recipient e-mail address and got it approved, but it still gave the same error.

TypeError: text is not iterable

PS D:\Idea Projects\github\US-visa-appointment-notifier> npm start
npm WARN config global --global, --local are deprecated. Use --location=global instead.

[email protected] start
node index.js

=====>>> Step: starting process with 250 tries left
=====>>> Step: logging in
TypeError: text is not iterable
at Keyboard.type (D:\Idea Projects\github\US-visa-appointment-notifier\node_modules\puppeteer\lib\cjs\puppeteer\common\Input.js:199:28)
at ElementHandle.type (D:\Idea Projects\github\US-visa-appointment-notifier\node_modules\puppeteer\lib\cjs\puppeteer\common\ElementHandle.js:629:79)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async login (D:\Idea Projects\github\US-visa-appointment-notifier\index.js:22:3)
at async process (D:\Idea Projects\github\US-visa-appointment-notifier\index.js:81:19)
at async D:\Idea Projects\github\US-visa-appointment-notifier\index.js:99:5
PS D:\Idea Projects\github\US-visa-appointment-notifier>

Process Timeout

I set the process to have a large number of tries (10000) but the app will shut down after some time ~2000 tries with below error message

Error: net::ERR_EMPTY_RESPONSE at https://ais.usvisa-info.com/en-ca/niv/schedule/46436140/appointment/days/94.json?appointments%5Bexpedite%5D=false
    at navigate (/workplace/XXX/US-visa-appointment-notifier/node_modules/puppeteer/lib/cjs/puppeteer/common/Frame.js:199:23)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Frame.goto (/workplace/XXX/US-visa-appointment-notifier/node_modules/puppeteer/lib/cjs/puppeteer/common/Frame.js:169:21)
    at async Page.goto (/workplace/XXX/US-visa-appointment-notifier/node_modules/puppeteer/lib/cjs/puppeteer/common/Page.js:1144:16)
    at async checkForSchedules (/workplace/XXX/US-visa-appointment-notifier/index.js:43:3)
    at async process (/workplace/XXX/US-visa-appointment-notifier/index.js:84:24)
    at async process (/workplace/XXX/US-visa-appointment-notifier/index.js:91:3)
    at async process (/workplace/XXX/US-visa-appointment-notifier/index.js:91:3)
    at async process (/workplace/XXX/US-visa-appointment-notifier/index.js:91:3)
    at async process (/workplace/XXX/US-visa-appointment-notifier/index.js:9

Error: Parameter "key" is required

There is no api that starts with key--xxxx

the one i could find under the sandbox domain does not seem to work.

Can you please help to identify which api key to use?

NEXT_SCHEDULE_POLL and multiple query cities

A wonderful tool! But I'm not sure if I can set the NEXT_SCHEDULE_POLL to a small number, like 1 min, because I'm a little concerned that my account will be locked if the query frequency is high. Does anyone know that?

And can I add two ids in the FACILITY_ID field?

Totally lost

I am trying to run this on my Mac.

  1. I saved the folder on Desktop
  2. I try to run the code on terminal but it isn't working

Could you please help me with the full syntax of what to type in Terminal to run this script from scratch?

I have added the values to config.js and saved it as config.env.
I have created an account on Mailgun, got the API key, and I've added authorized recipient.

Hoping to hear from you. These could come across as dumb questions, apologies for that. Thanks.

error after npm start

$ npm i

up to date in 42s

9 packages are looking for funding
run npm fund for details

vv@VNDCCORPHP1893 MINGW64 ~/Desktop/US-visa-appointment-notifier-main
$ npm start

[email protected] start
node index.js

C:\Users\vv\Desktop\US-visa-appointment-notifier-main\node_modules\puppeteer\lib\cjs\puppeteer\node\ChromeLauncher.js:70
throw new Error(missingText);
^

Error: Could not find expected browser (chrome) locally. Run npm install to download the correct Chromium revision (1022525).
at ChromeLauncher.launch (C:\Users\vv\Desktop\US-visa-appointment-notifier-main\node_modules\puppeteer\lib\cjs\puppeteer\node\ChromeLauncher.js:70:23)
at async C:\Users\vv\Desktop\US-visa-appointment-notifier-main\index.js:96:19

Node.js v18.14.0

TimeoutError

Hello ! Thanks for your application. But I do not know why I get this error anytime I run it.

TimeoutError: Navigation timeout of 30000 ms exceeded
at LifecycleWatcher._LifecycleWatcher_createTimeoutPromise (C:\Users\Labex\US-visa-appointment-notifier\node_modules\puppeteer\lib\cjs\puppeteer\common\LifecycleWatcher.js:164:12)
at async Frame.waitForNavigation (C:\Users\Labex\US-visa-appointment-notifier\node_modules\puppeteer\lib\cjs\puppeteer\common\Frame.js:236:23)
at async Page.waitForNavigation (C:\Users\Labex\US-visa-appointment-notifier\node_modules\puppeteer\lib\cjs\puppeteer\common\Page.js:1207:16)
at async login (C:\Users\Labex\US-visa-appointment-notifier\index.js:27:3)
at async process (C:\Users\Labex\US-visa-appointment-notifier\index.js:85:19)
at async C:\Users\Labex\US-visa-appointment-notifier\index.js:103:5

[]

Hi, thanks for your work

Right now I getting "[]" after the "Step: checking for schedules"

Any idea why?

Email not sending

Hello

Program is working well but the emails arent going through to my email and its the same as my mailgun username

for eg-Available date- [{"date":"2026-06-10","business_day":true}

in my config - NOTIFY_ON_DATE_BEFORE: 2026-11-11,

NOTIFY_EMAILS: '[email protected]',
mailgun: {
USERNAME: '[email protected]',
DOMAIN: 'sandboxfddxxxxx.mailgun.org',
API_KEY: 'pubkey-xxxx-xx-xx',

2 facilities

How can I control 2 facilities at the same time?

"No available appointments" banning?

Hi,

First, thanks a lot for the repo. It is indeed still working and quite simple to setup/modify.

I am curious what search rate is recommended to use? I often notice that while I have the script running, the website shows "no available appointments" when checked through the browser and I wonder if it is some sort of a DDoS protection mechanism that simply shuts down on rate querying?

TypeError: Cannot read properties of null (reading '$')

After it runs the script and logs in it gives this prompt :
at login (D:\US-visa-appointment-notifier-main\index.js:17:28) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async process (D:\US-visa-appointment-notifier-main\index.js:85:19) at async D:\US-visa-appointment-notifier-main\index.js:103:5

Failed to parse dates, probably because you are not logged in

hi there, Im getting the below error, do i need to login somewhere before i run this script, there are my cred saved in the .env.

**> [email protected] start

node index.js

=====>>> Step: starting process with 20 tries left
=====>>> Step: logging in
=====>>> Step: checking for schedules
{"message":"Facility is not valid","error":"bad_request"}
Unable to parse page JSON content

{"message":"Facility is not valid","error":"bad_request"}

Failed to parse dates, probably because you are not logged in
Terminate batch job (Y/N)? y_**_

Wrong open dates

The script shows dates that are not open.For example, the closest date is 06.25.2025 but the script shows 05.21.2024.The dates I checked are not open.

Where is my shcedule ID?

Hi, i am trying to run the project but i cant find my shcedule id in the visa website. Where i can find it?

Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.