Node.js Trade Notification for Steambot - node.js

I'm not a coder, but I'm asking on behalf of my web developer who isn't fluent with english, for everyone's expertise.
I'm trying to achieve a real time trade notification on my website.
I have the node.js bot working for all trading purpose already and its interacting with the web with socket.io. Inventory is working. But I do want to add an addtional functionality when the trade offer is send, a notification will also in real time event sent to user on my website at the same time my bot sent a trade offer to the user in steam.
Below is a screenshot example,
https://gyazo.com/ec41e836605f2284f834dd7606693e22
Really appreciate if anyone could help me out.

This all depends on the way you handle your data.
If you are making it so the bot sends a trade offer to the user then when you call your trade offer add in a
socket.emit('tradeOfferSent', {
});
to that user which can be picked up on the client side by
socket.on('tradeOfferSent',function(data) {
});
conversely if you are making your users send trade offers to the bot you can use on 'newOffer' from steam-tradeoffer-manager to emit the data as above.
Inside the on.socket('',function(){}); you are able to add anything you want as an notification. Such as using sweetalerts.

Related

Teams Bot how to listen on incoming calls?

I am getting lost in all the documentation available on my first time attempting to set up a Microsoft Teams bot. I have it set up and able to write command activated messages in personal, groups and teams. I need to transition this to be able to receive a payload of data (the data that I will use to populate my activity card), but I can't figure out how am I supposed to let the bot know which Group or Team the payload is ment for.
The payload will be sent from my Azure hosted API, to the endpoint of my Bot. It should then, with some data in the payload I suppose, know which group or team to sent the processed activity card to?
If you could provide me with the documentation I need to read up on, or further explanation on how to proceed, I would greatly appreciate it.
You can listen to teams bot for incoming calls,
Bots can interact with Teams calls and meetings using real-time voice, video, and screen sharing. With Microsoft Graph APIs for calls and online meetings, Teams apps can now interact with users using voice and video to enhance the experience. These APIs allow you to add the following new features:
Interactive voice response (IVR).
Call control.
Access to real-time audio and video streams, including desktop and app sharing.
please check this doc for more info and sample
I apologize for the delay in responding to you.
I read the documentation you sent, but I am not sure how it relates as I do not need real-time voice, audio or screen sharing capabilities.
I can understand that the title writing "incoming calls" could be cause of misunderstanding, however, the issue is as described that I need to forward a payload from my API endpoint that needs to be received in the Teams Bot that listens to that specific payload. I don't know how to approach a solution for that part, after that part the Teams Bot should then sendActivity with an activity card attachment (this I have prepared already using dummy data and the card designer for layout), containing that payload data, to the group/team that the Teams Bot is active on.
I resolved this using the answers from this thread:
Programmatically sending a message to a bot in Microsoft Teams
Specifically thanks to the message from #Hilton Giesenow:
https://stackoverflow.com/a/59439602/10429879

Google Hangouts Chatbot Create Room

I am writing service for messaging between rooms using Hangouts chatbot. Is it possible to create a room with Hangouts chatbot?
https://developers.google.com/hangouts/chat/concepts
If it were generally possible to create a new room programmaticaly with the Hangous API, you could do it with the chatbot.
For example, if you implement the chatbox with Apps Script, you can create a function onMessage(event) and establish was will to happen in case of a certain event.message.text (e.g. create a new chat room if the message text contains the string create new room.
However, for the moment it is not possible to create a new chat room programmatically.
There is a feature request asking for this functionality, but given the potential of abuse, it is controversial either it will be implemented.
See comment #2:
Hello, thank you for the feature request! At the moment rooms cannot
be created via the API to prevent abuse such as a bot or script
spamming room creation. However, this kind of feature has been
discussed internally and may be coming in the future (with
limitations). I will update this issue if more information is
released.
And comment #25:
Thanks for the input. It's great to see some real life use cases. We
fully acknowledge the importance of a CreateRoom(DM) API and we are
actively looking into the right permission model to allow bots to do
so. Please continue to follow this bug as we will post updates here
when appropriate.

Sending a message to user when user enters a geofence / area?

I'm making a dialogflow agent that will be integrated with various platforms (Facebook messenger, slack and maybe a few others) that will have the basic functions of a informational chatbot.
The agent will be for a specific store and I'm wondering if it's possible to trigger some sort of welcome message once the user enters the geofence (in this case, the store)?
Thanks for the help. I haven't found any documentation for this on dialogflow specifically or anywhere else so anything will be awesome.
Note: I'm am not by any means dead set of dialogflow, if AWS Lex offers something like this and it's better, I will take a look. I'm just a bit more used to dialogflow.
This cannot be achieved just by using either Lex or Dialogflow. Because at the end of the day, you are using them to integrate with Messenger/Slack/Whatsapp and these apps will (for obvious good reasons) not share the user's location information with the bot. You will need a helper app which takes the user's location permission as well and triggers the bots for you.
Keep in mind that channels like Messenger and Whatsapp have restrictions over sending messages willy-nilly to users. Messenger has a '24+1' policy Whatsapp also you can only send free form messages in the 24 hour window. But after that you can send chargeable pre-approved "hsm" message templates.

How to get instant changes in background from private api in mobile app?

I am planning to create a mobile application for android and ios users, i think i will take a try with xamarin since i will be alone on this project and i don't have a lots of time.
I want that the mobile app for both platform get datas from the api, then if there is new datas available we notify the user by a notification.
How the mobile will work in that kind of project? I mean should i make a background service then check every x seconds/minutes by http request? In that case which time interval? Should i use websockets instead for this case?
The app might be used by many people, so i would to know the scenario in this kind of project: Getting very fast changes, without overload the server due to too many connects or whatever else.
I'm confused about this and i need some lights around, any mobile application/server experiences related would be apprecied!
EDIT:
As suggered by an user, here additional infos:
The api is homemade, restful using JWT made in NodeJS.
Each users on their device should get messages from server asap, even when the app is in background/closed.
Maybe in the future a way to send messages between users themselves.
You have to implement push notification.
It is quite easy to implement this in xamarin. just send the push notification to the device and on the notification received call back send the API request to retrieve the updated data.
Here is the document for sending push notification from custom API.
https://learn.microsoft.com/en-us/appcenter/push/pushapi
I'm not a mobile developer, so take this with a grain of salt.
The answer to this really depends on what you're doing, which informs how often to check the API. If it's a messaging app, for example, you could have it check every couple minutes to see if there are undelivered messages, then check more frequently for the next X minutes (to facilitate a conversation in real time).
If it's a GPS navigation app to be used while driving, you'd need much more frequent requests.
As for the API, that also depends on what type of API and the number of requests you can make to it. Is it a commercial API that you get x number of calls per hour on? Is it an API that you built? Etc.
Basically, you need to give more information in order to get more specific answers.

How to implement a chatbot to human executive switch using Microsoft Bot Framework?

The exact point being, that I've created a bot that can take inputs from users in free form text and return relevant web links. Now the problem being, that in case the bot is not able to understand the user query, the control of the conversation has to be passed on to the human executive.
I've researched for over 2 days but could not find any such implementations. The closest I came was third party applications like ChatFuel, letsclap.io provide such a provision. So, there should be a way only that I am not able to find such a thing.
Any help on this would be appreciated.
one possible way is you can make a bridge, idea is as follow:
user send something that the bot cannot reply (conv-1)
make a new conversation with your human executive (conv-2)
forward user message to conv-2
human executive replied to the bot (conv-2)
capture the message and forward back to (conv-1)
See this link on how to start a new conversation:
https://docs.botframework.com/en-us/csharp/builder/sdkreference/routing.html#sendtoconversation
Hope it helps,
Maybe you can create some APIs in a WebApplication that will be used by your bot.
If the LUIS Intent "None" is called, you make a call to that API and start a new conversation with a human.
You can use this same process to manage all conversations in a WebApplication Chat Control

Resources