• Instructions to Ask a Question

    For any assistance, please click the "Ask a Question" button and select the Pabbly product for which you require support.

    We offer seven comprehensive applications designed to help you efficiently manage and grow your business:

    Our support team endeavors to respond within 24 business hours (Monday to Friday, 10:00 AM to 6:00 PM IST). We appreciate your understanding and patience.

    🚀 Exclusive Lifetime Offers 🚀

    We invite you to take advantage of our special one-time payment plans, providing lifetime access to select applications:

    • 🔥 Pabbly Connect — Lifetime Access for $249View Offer
    • 🔥 Pabbly Subscription Billing — Lifetime Access for $249View Offer

    Make a one-time investment and enjoy the advantages of robust business management tools for years to come.

SyntaxError: Invalid or unexpected token for Javascript code

teknikal

Member
I'm having issues running javascript code. works fine on my local machine, but getting the SyntaxError and I cant debug the issue as the error is too generic. can someone take a look?


Workflow Attached
Code is as follow (without APIKey)


Code:
 const apiUrl = "https://api.cliniko.com/v1/appointments?q[]=starts_at:>=2023-08-24T00:00:00z&q[]=starts_at:<2023-08-25T00:00:00z";
 const dateToRetrieve = '2023-08-24'; // Replace with the desired date

async function getAppointmentsForDate(date) {


 try {
  const response = await fetch(apiUrl, {
 
   headers: {
    authorization: 'Basic ',
    'user-agent': 'Locally',
   accept: 'application/json',
   'content-type': 'application/json'
   }
  });

  const filteredAppointments = response.json().then(result => result.appointments.filter(appointment => appointment.did_not_arrive));//;
  return filteredAppointments;
 } catch (error) {
  throw new Error(error);
 }
}


getAppointmentsForDate(dateToRetrieve)
 .then(appointments => {
  console.log('Appointments:', appointments);
 })
 .catch(error => {
  console.error('Error:', error);
 });
 

ArshilAhmad

Moderator
Staff member
Hi @teknikal,

Please note that Code by Pabbly requires proficient coding skills. We kindly request you to test your code on a compiler to ensure that it is functioning correctly. For issue related to coding, we suggest seeking the help of a developer (or using ChatGPT). Unfortunately, we cannot assist you with coding-related issues as they are beyond the scope of our expertise.
1692922939089.png
 

teknikal

Member
The code works for me, but not when using pabbly as a step. how am I meant to debug this? are you able to provide more info on the error?
 

ArshilAhmad

Moderator
Staff member
Could you please share a short video showing this code working in a JS compiler? It would help us get a better understanding of the issue.
 
Top