I have been trying to make a web app that has a certain feature like uber where users can see other users on a map. I read about pubNub (https://www.pubnub.com/) and I saw they have a tutorial that allows you to track movements on a map https://www.pubnub.com/tutorials/javascript/mapping-javascript-tracking/.
They also provide a tool called presence (https://www.pubnub.com/products/presence/) which allows you to see if users have joined your web session or not. I would like to, with presence, to show on a map if people have joined the session or left the session. If they are on the map, I would like the movements to be updated as well.
I am just wondering if someone has used pubNub before to achieve something similar and if so how to go about it?
Clone Uber with PubNub and EON Maps
https://github.com/pubnub/pubnUber - GitHub Repository
Today we're going to use Phonegap and PubNub to create a simple taxi hailing app. What we'll walk through today is the same technology stack used by Uber, Gett, and other taxi hailing apps. They all work in a similar fashion.
Getting started
Install phonegap on the CLI.
Clone this repository locally.
The repo contains two directories /rider and /driver. We're going to start with /driver.
Set Up PubNub
First, we need to set up PubNub. the PUBNUB variables comes for free from the EON library. The publish_key and subscribe_key settings come from your PubNub account.
var channel = "pubnub-taxi-app";
var pubnub = PUBNUB.init({
publish_key: 'demo',
subscribe_key: 'demo'
});
The pubnub plugs the same pubnub variable we configured in the first step into EON. This lets us use our own PubNub keys within EON.
Our Mapbox configuration is set and we're ready to send some
Publish messages to the channel
Define our PubNub channel.
Subscribe.
pubnub.subscribe({
channel: channel,
message: function(message,env,channel){
if(message == 'hail') {
var pickup = confirm("Someone requested a ride!", "Accept");
if(pickup) {
pubnub.publish({
channel: channel,
message: 'pickup'
});
}
}
}
});
And here is the hail() function.
var hail = function(argument) {
pubnub.publish({
channel: channel,
message: 'hail'
});
alert('Waiting for driver...');
};
Related
I want to query the presence of users in a Slack workspace.
Using the old (classic) app, I can do it using presence_query via Slack RTM.
However, RTM requires depracted bot scopes (and the old classic app).
Can I use (and how) presence_query with the new slack app (I'm using python)?
This is my current implementation (using the old classic app):
from slack_sdk.rtm_v2 import RTMClient
rtm_client = RTMClient(token='SLACK_BOT_TOKEN')
#rtm_client.on("presence_change")
def receive_presence_changes(client:RTMClient, event:dict):
print(event)
rtm_client.connect()
rtm_client.send(
payload={
"type" : "presence_query",
'ids' : ids_list,
}
)
No, there are currently no ways to subscribe to presence-oriented events on the Events API or via Socket Mode. The legacy RTM API is the only avenue still available.
What I'd like to do is write some code like:
var googleHome = new GoogleHomeSdk();
var devices = ['kitchen', 'lounge', 'bedroom'];
googleHome.broadcast({
devices : devices,
message : 'The front door has been open for 30 seconds'
});
Which would then do something similar to the native broadcast feature, i.e. where you type 'broadcast ' into the google assistant app on phones/tablets.
I can't seem to find any google documentation for an API like this but it seems like such a basic/obvious requirement that surely something like this must exist?
Note: I've seen a workaround where people have casted an audio file (obtained via text-to-speech service) but this isn't really what I'm after.
The platform does not provide a mechanism to programmaticlly broadcast messages to different devices.
I'm a bit fed up with other phone providers and would like to have a more programmable, configurable, personal phone number (I miss GrandCentral). Google Voice is good, but I want to build something better. Twilio is great! I'm considering porting my personal phone number to Twilio.
I already have phone routing TwiML figured out, but where I'm stuck is text messaging. I can't just forward text messages to my burner phone/smart phone, because for replies to be natural, I need to be able to reply and have it get routed back to the sender. Google Voice handles this by forwarding every incoming forwarded text from a unique number so replies go to the right place, but I think this would get expensive quick with Twilio.
Is there a simple app or gateway that someone somewhere has already built (Twilio themselves perhaps) that lets me reply to texts to a Twilio phone number? It could be a web app, mobile app, WhatsApp gateway, whatever.
I looked into Twilio Programmable SMS/Chat, which definitely seems like the right building blocks, but also seems like to solve this I'd be building a web/mobile app and a backend service to manage my texts. Surely something already exists for manual text response to Twilio numbers.
I looked into Twilio Flex (and other customer management/agent center solutions) and that could work! But it seems overkill and I couldn't find a way to do Twilio Flex agent responses (e.g., reply to my family) on my smart phone. Is there a Twilio Flex mobile app? Is there something less overkill? I thought for sure I'd find something in the Twilio dashboard that would let me manually reply to texts.
Just looking for the most basic SMS/MMS inbox with reply functionality for a Twilio phone number I can find without having to build too much. Thanks!
FrontApp is another paid service that supports a Twilio integration for SMS messaging. There isn’t exactly a huge base of people using Twilio for individual purposes, so I don’t think it’s that surprising that what you’re looking for doesn’t already exist (though I agree it would be cool if it did).
Potentially, you could also look into the Twilio CLI utility as a way to interact with the API without so much developer overhead. Perhaps your new SMS interface is just going to be an SSH client on your phone connected to a box with the Twilio CLI installed?
An easy way to use your number for free (besides Twilio's costs) is to use a Google Spreadsheet with a script attached.
Here is a basic template you could start from and adjust accordingly.
STEP 1. Create New Google Spreadsheet.
STEP 2. Label columns A-E Date, From, Incoming Message, Reply, Status.
STEP 3. Open script editor and clear contents and paste code below.
STEP 4. Edit script by inserting your TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN, (can be found in your Twilio dashboard) TWILIO PHONE NUMBER.
STEP 5. Deploy your script as a web app MAKE SURE to set the "who has access to the app" to "anyone, even anonymous" (Twilio will only work with public URLs).
STEP 6. After deployed copy the web app URL supplied by google.
STEP 7. Go to your Twilio phone numbers and paste the URL as the webhook for when a message comes in, MAKE SURE you change it to HTTP GET.
NOTE: make sure to authorize the script, by running the function from script editor.
function doGet(e) {
var body = e.parameter.Body;
var from = e.parameter.From;
var time = new Date();
var ss = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet()
ss.appendRow([time,from,body]);
}
function onOpen() {
var ui = SpreadsheetApp.getUi();
ui.createMenu('Reply')
.addItem('Send Reply', 'sendText').addToUi();
}
function sendText(){
var ss = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var range = ss.getActiveRange();
var message = range.getValue();
var getNumber = ss.getRange(range.getRow(), 2).getValue();
var number = '+' + getNumber;
var messagesUrl = "https://api.twilio.com/2010-04-01/Accounts/PASTE_YOUR_TWILIO_ACCOUNT_SID_HERE/Messages.json";
var payload = {
"To": number,
"From" : "PASTE_YOUR_TWILIO_PHONE_NUMBER_HERE", //make sure its formated as +15556667777
"Body" : message,
};
var options = {
"method" : "post",
"payload" : payload
};
options.headers = {
"Authorization" : "Basic " + Utilities.base64Encode("PASTE_YOUR_TWILIO_ACCOUNT_SID_HERE:PASTE_YOUR_TWILIO_AUTH_TOKEN_HERE")
};
UrlFetchApp.fetch(messagesUrl, options);
return ss.getRange(range.getRow(), 5).setValue('Sent');
}
To use it type a reply in the row you want to respond to make sure any cell in that row is selected, then go to the "Reply" tab and click "send text"
Here is a free android app you can download from the google play store. It was created by a Twilio employee, and offers what you were looking for. It does have some limitations which you can read in the description.
https://play.google.com/store/apps/details?id=com.tigerfarmpress.owlsms
I'm exploring possibilities of creating a Bot for iMessages. I went through the "Messages SDK" provided by Apple for iMessage extensions and didn't find any leads.
Android has Telephony(https://developer.android.com/reference/android/provider/Telephony) which I could use as a starting point. But I couldn't find anything similar on iOS.
If anyone knows how I could achieve this, it would be of great help.
You might want to check out Jared, an open-source iMessage chatbot which reads from the message database.
https://github.com/ZekeSnider/Jared
You could check out https://sendblue.co
Here is their documentation: https://docs.sendblue.co
I assume you can send and receive iMessages by simply hitting their endpoint with a post request, like so:
const url = `https://api.sendblue.co/api/send-message` ;
axios.post(url, {
number: '+19998887777',
content: 'Hello world!',
statusCallback: 'https://example.com/message-status/1234abcd',
},
headers: {
"sb-api-key-id": << apiKey >> ,
"sb-api-secret-key": << apiSecret >>
},
}).then(response => {
console.log(response.data);
}).catch(error => {
console.error(error);
});
You can receive iMessages by registering a webhook with them.
Cheers
iMessages is a closed platform, I don't think I have that possibility.
you can check
https://developer.apple.com/business-chat/
Business Chat
is a powerful new way for organizations to connect with customers directly from within Messages. Using Business Chat, your customers can get answers to questions, resolve issues and complete transactions on their iPhone, iPad, Mac and Apple Watch. Customers can find your business and start conversations from Safari, Maps, Search and Siri.
I have an idea! You could just add a phone number or an email to the chat that is connected to a bot script which would send messages directly from that phone number/email. I think that would work.
I am writing an app for Corona SDK (Using LuaSocket) to be able to subscribe and post messages to the example chat server that runs in socket.io (using gevent-websocket 0.9).
I have checked that chat.js on the server interacts with ther server like this:
To subscribe to a room:
socket.subscribe('room-2000')
Or interacting with the chat room:
socket.send({room: 'room-2000', action: 'start', name: 'John'})
socket.send({room: 'room-2000', action: 'message', message: 'hi there!)});
etc..
Full js client script.
But I don't find a way to make an app for Corona SDK to interact with a channel. I managed to connect to the server with:
socket.connect( my_ip, my_port)
But cannot find a way to subscribe or post/receive messages, can someone give me a clue? Will be highly appreciate it.
AFAIK, you need to do a WebSocket handshake. Read the WebSocket specifiation.
Otherwise, I can recommend you this Publish/Subscribe library for CoronaSDK/Nodejs
https://github.com/Overtorment/NoobHub