I'm currently make bot for messenger. I read the docs and there are curl, I still don't understand how to make it work in my server. I'm using node js as server and deploy my code in Heroku.
You can either use a package like request (https://www.npmjs.com/package/request) to make HTTP calls (communicate) to the Facebook Graph API or build your entire bot using a framework like BootBot (https://github.com/Charca/bootbot). BootBot makes it rather easy to create and deploy a Facebook Messenger bot using nodejs.
Related
I am trying to get my head around web hooks. I receive a web hook from Shopify. I use https://beeceptor.com/ to receive the web hook which looks like the screenshot attached. It is a JSON. I want to use python to process the received POST and take some action. Can I know how I can retrieve this using python? Do I need to use the Flask framework or can I do with request? Here are details from Shopify https://shopify.dev/tutorials/manage-webhooks#verify-webhook
which I am unsure of.
You need to create a web app that can accept incoming HTTP traffic from Shopify - you can do this in Flask/Python or really any other web technology stack. Services like AWS Lambda can also work to receive the webhook and do some processing.
I'm learning Dialogflow right now, and I'd like to connect a bot to some frontend web code. I know about the Node.js API for Dialogflow, but for my current purposes, it seems a little over-complicated. The only functionality I need right now is sending user input to the bot and receiving the bot's response, so it seems like setting up an entire server just to communicate with the bot is pretty excessive.
Is there a way to communicate with the bot from the frontend directly, like an HTTP API? Or is the NPM package the only option?
This is the only endpoint that you need: https://cloud.google.com/dialogflow-enterprise/docs/reference/rest/v2/projects.agent.sessions/detectIntent. As long as you get the authentication right you should be good to go.
I am trying to host my web app on localhost. I am using directline 3.0 and I want to push the messages into a window using websockets. I don't want to embed the bot. I already have the GET and POST request so I can send and receive the conversation by running the javascript files with the bearer tokens and get back the conversation running by sending and receiving messages from the bot but I want this to take place on the localhost website on a chat based window without embedding.
How can I do this? How do I link the chat window of websockets to the GET and post files so i can send the messages in real time.
I would recommend you integrate Direct Line directly (no pun intended) into you project by using the BotFramework-DirectLineJS package. This package is built specifically for communicating with a bot without using WebChat as the UI component.
There is a v3 example that you can reference. The project splits between the DirectLineBot and the DirectLineClient. The DirectLineBot demonstrates a v3 bot. You'll need to update this folder to include your v4 bot. The DirectLineClient works the same with v3 or v4. So, as your client connects, generates a token, and begins sending activities, your v4 bot should pick these up and respond accordingly. Similarly, your client should pick up the bot's responses.
At this point, you need to update your client to display the activities as they are sent and received from the user / bot.
You might also consider looking over this unofficial "plain ui" sample from the WebChat dev. It uses React however it does not rely on WebChat as the UI component. I was able to spin it up in about 5 mins. It is purposefully stripped of any styling and simply posts activities to the page as text/json objects.
You could remove the input field and configure the page to accept inputs to render on the page. It might be a useful starting place and could fit well with the above DirectLineJS option.
If none of those options are agreeable, then you will need to use Axios, Fetch, or some similar package to make your GET, POST, etc., calls between your client and bot.
Hope of help!
basically I am trying to figure out a way to make a connection between my Discord Bot and my Website, I have some ideas in mind in using GET and POST methods but IDK how to use them in NodeJs nor in the website as I am still new to it, so what I want is to send a packet of data from the website after a submit button and the bot which is hosted locally with the website will receive this data and work with it.
Express is a commonly used web framework for Node that takes care of routing fairly easily. You can see their documentation here.
I have recently started learning how to use node.js and Meteor. I am trying to create a small app that I can query via a client built in meteor, but also query that same MongoDB via SMS using the Twilio API. I can see that this can be done with Express: How can I respond to incoming Twilio calls and SMS messages using node.js? but I wanted to use Meteor because of its apparent ease-of-use and integration with a database. I've been reading various questions about routing templates and serving static html pages in Meteor, but is there a solid way someone think I can make this work? Should I just go back to plain Express?
Twilio expects you to give them the URL where the XML response will be hosted: http://www.twilio.com/docs/quickstart/php/sms/hello-monkey
My earlier response is outdated. Today one should use iron:router and create a server-side route.