crisp-im / node-crisp-api

:zap: Crisp API Node Wrapper
https://docs.crisp.chat/guides/rest-api/
MIT License
99 stars 38 forks source link

Bug: Error 404 not subscribed when getting conversations #31

Closed jely2002 closed 3 years ago

jely2002 commented 3 years ago

I'm trying to create a plugin for the company I work for. I have setup the plugin, added the right permissions, got it approved and added it to our website. When I try to get some conversations by search it always throws the following error:

{
  reason: 'error',
  message: 'not_subscribed',
  code: 404,
  data: {
    namespace: 'response',
    message: 'Got response error: not_subscribed'
  }
}

I have tried using the CrispClient.websiteConversations.getList endpoint as well, it gave me the same error. This behavior is most likely a bug as the request works fine when I send a raw GET request to the endpoint.

Below I have some example code of how I'm accessing the API.

 const CrispClient = new Crisp();
 CrispClient.setTier("plugin");
 CrispClient.authenticate(identifier, key);

try {
    const res = await CrispClient.websiteConversations.findWithSearch(websiteId, page, {
        filterNotResolved: 1
    });
} catch(e) {
    console.error(e);
}

Is there something I'm doing wrong or is this a bug?

baptistejamin commented 3 years ago

Hello !

It feels like the website ID you are using is not bound to the plug-in.

Did you associate a website to your development account ?

jely2002 commented 3 years ago

Hi! This error occurs while using the website id of a website that has the plugin installed. The plugin shows up fine on the installed plugins page. I don't think it would be a good idea to link our website to my marketplace as a development website. As this website is a live website.

When I execute the same query to the api with postman it works fine. Using the same website id and authentication.

baptistejamin commented 3 years ago

Can you contact us on contact@crisp.chat because we may ask sensitive information

jely2002 commented 3 years ago

I just retried my code. And it works now, it may have been an error on my side. Although I'm unsure. Thank you for your time nonetheless. Closing this issue.