• Instructions to Ask a Question

    Click on the "Ask a Question" button and select the application for which you would like to ask questions.

    We have 5 different products namely - Pabbly Connect, Pabbly Subscription Billing, Pabbly Email Marketing, Pabbly Form Builder, Pabbly Email Verification.

    The turnaround time is 24 hrs (Business Hours - 10.00 AM to 6.00 PM IST, Except Saturday and Sunday). So your kind patience will be highly appreciated!

    🚀🚀Exclusive Discount Offer

    Just in case you're looking for any ongoing offers on Pabbly, you can check the one-time offers listed below. You just need to pay once and use the application forever -
     

    🔥 Pabbly Connect One Time Plan for $249 (🏆Lifetime Access) -  View offer 

    🔥 Pabbly Subscription Billing One Time Plan for $249 (🏆Lifetime Access) - View offer

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