4

I am using sendy-api, to do subscribe for user from the code. I am using javascript. Also I have followed sendy-github .

I want to check the status of the user before doing subscribe. If user is unsubscribed already, I dont want to subscribe again. Giving the code that I have tried.

var Sendy = require('sendy-api'),
    sendy = new Sendy('http://your_sendy_installation'),
    
    sendyStatus = new Sendy('http://your_sendy_installation/api/subscribers/subscription-status.php'); //There is something wrong in this part I think

var eachUser = {em : 'abcd@xyz.com'};

 sendyStatus.status({email: eachUser.em, list_id: 'someListID'}, function(err, userInfo)                       
   {
      console.log(userInfo)
   });

Getting the error as below:-

Error in getting user status from sendy{ [Error: [404 error] If you're seeing this error after install, check this FAQ for the fix: https://sendy.co/troubleshooting#404-error] [message]: '[404 error] If you\'re seeing this error after install, check this FAQ for the fix: https://sendy.co/troubleshooting#404-error' } at [Tue May 10 2016 12:55:30 GMT+0530 (IST)] jobScheduler:error: performJob failed{ [Error: [404 error] If you're seeing this error after install, check this FAQ for the fix: https://sendy.co/troubleshooting#404-error] [message]: '[404 error] If you\'re seeing this error after install, check this FAQ for the fix: https://sendy.co/troubleshooting#404-error' } at [Tue May 10 2016 12:55:30 GMT+0530 (IST)]

Any body has any idea how to solve the issue? Anything wrong I am doing?

Shrabanee
  • 2,706
  • 1
  • 18
  • 30
  • The error you get is self explanatory. Did you checked that faq. Did you upload the `.htaccess` file? Did you applied the `AllowOverride All` in your web server configuration? – vaso123 May 10 '16 at 07:42
  • @lolka_bolka will check for this. This may solve the problem. – Shrabanee May 10 '16 at 08:14

1 Answers1

0

I forgot to add 'api-key' so I was getting the error, as it is written in github.

Now the code is as below and it is working :-

var Sendy = require('sendy-api'),
    sendy = new Sendy('http://your_sendy_installation', 'api-key'); // Without api key it won't work.
   

var eachUser = {em : 'abcd@xyz.com'};

 sendy.status({email: eachUser.em, list_id: 'someListID'}, function(err, userInfo)                       
   {
      console.log(userInfo) // will give status of the user.
   });
Shrabanee
  • 2,706
  • 1
  • 18
  • 30