Getting a Messenger Chat Bot to work

Not applicable

I’m a novice API developer with an API build with Node.js running in Apigee’s public server. I now want to create a Facebook Messenger chat bot that talks to my API, but it looks like I need to do an NPM of Messenger’s node code to make it work.

How do I do an NPM on the public server?

Is there another way other than doing an NPM?

I think these are the requirements:

1- Node.js version grater than 4.0

2- npm install messenger-bot

Any help would be appreciated

Solved Solved
0 6 1,199
1 ACCEPTED SOLUTION

adas
Participant V

@raasdex Is there any way you can add me to your org or email me your apiproxy and other details. My id would be adas@apigee.com

You can either add me to your org and send me the details, or just send me the proxy and explain me the use case you are trying to solve. Btw, since your original query about npm is resolved, would you mind accepting the answer and opening a separate thread for this new discussion, in the spirit of the community.

View solution in original post

6 REPLIES 6

adas
Participant V

@raasdex If your question is about how you can run npm, there are two options:

You can run npm locally on your project and then import/deploy the proxy to Apigee Edge. The option option is to use the npm management apis that Apigee provides. You can find more details here

There's a very good blog post about apigee127 and npm here

These should be good starting points for you if you are getting started with api development on Edge with node.js

I tried your first link but was unable to get it to work. I was able to see my API but not able to "npm install messenger-bot". Can you see my error or possibly offer more advice?

HTTP/1.1 500 Server Error

Connection:
keep-alive
Content-Length:
185
Content-Type:
application/json
Date:
Wed, 27 Apr 2016 20:42:34 GMT
Server:
Apigee Router
{
  "code": "scripts.node.InvalidAction",
  "message": "Invalid action {install messenger-bot}: Valid actions are [dedupe, install, ls, outdated, prune, update]",
  "contexts": []
}

adas
Participant V

You need to declare the dependencies in the package.json . Once you have done that, you need to make a POST call like this: (make sure you are passing the correct body like command=install)

curl -v "https://api.enterprise.apigee.com/v1/o/yourorg/apis/yourapi/revisions/1/npm" -d 'command=install'

I think this package.json solution solved my problem getting npm messenger-bot loaded, but I still can't test with Facebook until I can solve this new problem encountered while setting up my Messenger webhook.

"The URL couldn't be validated. Callback verification failed with the following errors: HTTP Status Code = 500; HTTP Message = Internal Server Error"

I submitted the URL from my API's admin console: "https://raas-test.apigee.net/raas" (this is a fake address just to illustrate)

Facebook does not allow "http" must be "https"

Looking for clues on how to solve this problem.

adas
Participant V

@raasdex Is there any way you can add me to your org or email me your apiproxy and other details. My id would be adas@apigee.com

You can either add me to your org and send me the details, or just send me the proxy and explain me the use case you are trying to solve. Btw, since your original query about npm is resolved, would you mind accepting the answer and opening a separate thread for this new discussion, in the spirit of the community.

I will add you as an admin to my account and start a new thread