Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The Smooch bot doesn't start anymore #19

Open
MecuSorin opened this issue Feb 1, 2019 · 5 comments
Open

The Smooch bot doesn't start anymore #19

MecuSorin opened this issue Feb 1, 2019 · 5 comments

Comments

@MecuSorin
Copy link

MecuSorin commented Feb 1, 2019

Noticed recently that the smooch bot integration doesn't work. Smooch doesn't support that route anymore?

Request:

POST https://api.smooch.io/v1/init HTTP/1.1
Host: api.smooch.io
Connection: keep-alive
Content-Length: 384
Origin: http://sorin-cv-bot.herokuapp.com
x-smooch-sdk: web/3.15.2
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36
app-token: ________________________
Content-Type: application/json
Accept: application/json
DNT: 1
Referer: http://sorin-cv-bot.herokuapp.com/
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9,ro;q=0.8

{"userId":"","device":{"platform":"web","id":"________________________________","info":{"sdkVersion":"3.15.2","URL":"sorin-cv-bot.herokuapp.com","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36","referrer":"","browserLanguage":"en-US","currentUrl":"http://sorin-cv-bot.herokuapp.com/","currentTitle":""}}}

Response:

HTTP/1.1 404 Not Found
Date: Fri, 01 Feb 2019 08:50:55 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 133
Connection: keep-alive
Server: nginx/1.13.8
Vary: X-HTTP-Method-Override, Origin
Access-Control-Allow-Origin: http://sorin-cv-bot.herokuapp.com
Access-Control-Allow-Credentials: true
Access-Control-Expose-Headers: Retry-After
Cache-Control: private, no-cache, no-store, must-revalidate
Expires: -1
Pragma: no-cache
ETag: W/"85-T7rlbbSI/uaihhE/TnktV3e+vE0"

{"error":{"code":"route_not_found","description":"There is no handler at this endpoint. Please ensure you've entered it correctly."}}
@DataWearsAHood
Copy link

This route is deprecated and the v1.1 API should be used instead; this endpoint is not explicitly called out anywhere in the code either - if you are including the latest smooch package the correct endpoint should be called to initialize the Smooch app/object.

@MecuSorin
Copy link
Author

The project was made in 2016 based on https://github.com/alavers/smooch-bot-example

I tried to update the dependencies to fix the issue, but the problem persists. I deleted the Smooch webhook (that was API version 1.0), and the app created a new Smooch webhook with API version 1.1 .

Given the smooch-core version 8.1.0 resolved, I assume that is the correct one.

This is package.json:

{
  "name": "smooch-bot-example",
  "version": "1.0.0",
  "description": "Smooch Bot Example Apps",
  "author": "Andrew Lavers <[email protected]> (http://smooch.io/)",
  "scripts": {
    "start": "node heroku"
  },
  "license": "MIT",
  "dependencies": {
    "body-parser": "^1.15.0",
    "crypto-js": "^3.1.6",
    "express": "^4.13.4",
    "hbs": "^4.0.0",
    "jsonwebtoken": "^5.7.0",
    "lodash": "^4.6.1",
    "request-promise": "^3.0.0",
    "smooch-bot": "https://github.com/alavers/smooch-bot.git",
    "smooch-core": "^8.1.0"
  },
  "devDependencies": {
    "gulp": "^3.9.1",
    "gulp-nodemon": "^2.0.6",
    "babel-eslint": "^6.0.0",
    "esformatter": "^0.9.1",
    "esformatter-braces": "^1.2.1",
    "esformatter-dot-notation": "^1.3.1",
    "esformatter-quotes": "^1.0.3",
    "eslint": "^2.2.0"
  }
}

This is a fragment from package-lock.json:

...
 "smooch-bot": {
      "version": "git+https://github.com/alavers/smooch-bot.git#f9ff078502ca5ddbdc9b1fdcdceab1aad6905427",
      "from": "git+https://github.com/alavers/smooch-bot.git",
      "requires": {
        "smooch-core": "^3.0.0"
      },
      "dependencies": {
        "async": {
          "version": "0.9.2",
          "resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz",
          "integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0="
        },
        "combined-stream": {
          "version": "0.0.7",
          "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-0.0.7.tgz",
          "integrity": "sha1-ATfmV7qlp1QcV6w3rF/AfXO03B8=",
          "requires": {
            "delayed-stream": "0.0.5"
          }
        },
        "delayed-stream": {
          "version": "0.0.5",
          "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-0.0.5.tgz",
          "integrity": "sha1-1LH0OpPoKW3+AmlPRoC8N6MTxz8="
        },
        "form-data": {
          "version": "0.2.0",
          "resolved": "https://registry.npmjs.org/form-data/-/form-data-0.2.0.tgz",
          "integrity": "sha1-Jvi8JtpkQOKZy9z7aQNcT3em5GY=",
          "requires": {
            "async": "~0.9.0",
            "combined-stream": "~0.0.4",
            "mime-types": "~2.0.3"
          }
        },
        "jsonwebtoken": {
          "version": "5.4.1",
          "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-5.4.1.tgz",
          "integrity": "sha1-IFXGORlf/lYxT6alHfAkaBhqlpU=",
          "requires": {
            "jws": "^3.0.0",
            "ms": "^0.7.1"
          }
        },
        "mime-db": {
          "version": "1.12.0",
          "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.12.0.tgz",
          "integrity": "sha1-PQxjGA9FjrENMlqqN9fFiuMS6dc="
        },
        "mime-types": {
          "version": "2.0.14",
          "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.0.14.tgz",
          "integrity": "sha1-MQ4VnbI+B3+Lsit0jav6SVcUCqY=",
          "requires": {
            "mime-db": "~1.12.0"
          }
        },
        "ms": {
          "version": "0.7.3",
          "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.3.tgz",
          "integrity": "sha1-cIFVpeROM/X9D8U+gdDUCpG+H/8="
        },
        "smooch-core": {
          "version": "3.5.0",
          "resolved": "https://registry.npmjs.org/smooch-core/-/smooch-core-3.5.0.tgz",
          "integrity": "sha1-VaJ4V3Qs7Bc0vRjiSrgGX1fN8Os=",
          "requires": {
            "form-data": "0.2.0",
            "isomorphic-fetch": "2.2.0",
            "jsonwebtoken": "5.4.1"
          }
        }
      }
    },
    "smooch-core": {
      "version": "8.1.0",
      "resolved": "https://registry.npmjs.org/smooch-core/-/smooch-core-8.1.0.tgz",
      "integrity": "sha512-/g7LQNLDHlZqnS9lAY1+H7maz1oc9H7bX2koo7fr+S/RARc29rb2M35FN/RDCtR5gtQkuk/yV3FyCIRFVocPnQ==",
      "requires": {
        "form-data": "0.2.0",
        "jsonwebtoken": "5.4.1",
        "node-fetch": "1.7.2"
      },
      "dependencies": {
        "async": {
          "version": "0.9.2",
          "resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz",
          "integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0="
        },
        "combined-stream": {
          "version": "0.0.7",
          "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-0.0.7.tgz",
          "integrity": "sha1-ATfmV7qlp1QcV6w3rF/AfXO03B8=",
          "requires": {
            "delayed-stream": "0.0.5"
          }
        },
        "delayed-stream": {
          "version": "0.0.5",
          "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-0.0.5.tgz",
          "integrity": "sha1-1LH0OpPoKW3+AmlPRoC8N6MTxz8="
        },
        "form-data": {
          "version": "0.2.0",
          "resolved": "https://registry.npmjs.org/form-data/-/form-data-0.2.0.tgz",
          "integrity": "sha1-Jvi8JtpkQOKZy9z7aQNcT3em5GY=",
          "requires": {
            "async": "~0.9.0",
            "combined-stream": "~0.0.4",
            "mime-types": "~2.0.3"
          }
        },
        "jsonwebtoken": {
          "version": "5.4.1",
          "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-5.4.1.tgz",
          "integrity": "sha1-IFXGORlf/lYxT6alHfAkaBhqlpU=",
          "requires": {
            "jws": "^3.0.0",
            "ms": "^0.7.1"
          }
        },
        "mime-db": {
          "version": "1.12.0",
          "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.12.0.tgz",
          "integrity": "sha1-PQxjGA9FjrENMlqqN9fFiuMS6dc="
        },
        "mime-types": {
          "version": "2.0.14",
          "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.0.14.tgz",
          "integrity": "sha1-MQ4VnbI+B3+Lsit0jav6SVcUCqY=",
          "requires": {
            "mime-db": "~1.12.0"
          }
        },
        "ms": {
          "version": "0.7.3",
          "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.3.tgz",
          "integrity": "sha1-cIFVpeROM/X9D8U+gdDUCpG+H/8="
        },
        "node-fetch": {
          "version": "1.7.2",
          "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.2.tgz",
          "integrity": "sha512-xZZUq2yDhKMIn/UgG5q//IZSNLJIwW2QxS14CNH5spuiXkITM2pUitjdq58yLSaU7m4M0wBNaM2Gh/ggY4YJig==",
          "requires": {
            "encoding": "^0.1.11",
            "is-stream": "^1.0.1"
          }
        }
      }
    },
...

@MecuSorin
Copy link
Author

I think that the problem comes from the cdn script file used: https://cdn.smooch.io/smooch.min.js (3.15.2)
A newer version exists on the cdn?

@enrinal
Copy link

enrinal commented May 13, 2020

So, @MecuSorin do you solved this issue? I want create chatbot using this.

@DataWearsAHood
Copy link

@MecuSorin this code was intended as an example and was provided by an individual contributor, so was not maintained as the API has evolved.
If you require further assistance and have a paid Sunshine Conversations subscription, I invite you to reach out to your support contacts, or use the chat widget while logged in to you app.smooch.io account.

@enrinal to get started with our APIs, I invite you to refer to our public docs on how to send messages using the API and receive messages via webhook events.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants