Me and my friends are building the same app on different platforms, but with a single RESTful API built with Node.js and MongoDB. If, for instance, a user changes something, like a setting, and the setting gets updated in the database, how can I make it so other users get notifications from their app? Like one user sends a friend request to me, and then I get a
notification with the friend request. This applies to both Flutter and SwiftUI. It seems weird for me, because working with this API, it's only about requests and responses, and I don't have any idea how to make the API trigger notifications on the app. So please, tell me a way to do this, or something I can look into. Thank you.
Related
I'm have built an app that the user save package tracking numbers and then when tapping on them the app sends a request to the parcel provider and gets back the tracking info. Pretty simple.
What i want to do is to create a backend server that stores the user's tracking codes and checks them at regular intervals. When the status change then the user gets a push notification.
My thought is to use a Nodes.js server with a MongoDB database but i'm stuck how to implement the tracking code monitoring on the server. Should i use a timer? Is there a better/simpler approach for this?
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.
Is there a way to do the following in a SPA:
Add User
Update list of users, for all other logged in users, with the added user if they are in the User List Module of the application. Do this without a chron job constantly checking if there is a new user.
Almost like forcing a response without a Request. Is this a Unicorn?
I am trying to see if there is an efficient way of doing this.
Technologies are NodeJS, Express, and React on the client.
You could try setting up a websocket connection between your logged in users and your server. That way, you would be able to push a change (like a new user being added) to all your clients. However, all the clients would still need to be constantly online. Try looking into socket.io as a gentle introduction to websockets.
You could also try looking into WebRTC and other P2P web technologies, though I'm not sure if that would help you in any way.