Is it possible create bots for iMessage? - ios

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.

Related

How to programmatically trigger google home broadcast

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.

How can I best manually reply to texts from a Twilio phone number?

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

iPhone development - Viber integration

Somebody knows how to send a message through Viber inside my app?
I've been trying send:
viber://[local] (ex. viber://63648018)
viber://[domestic] (ex. viber://08963648018)
viber://[international] (ex. viber://+498963648018)
with no success.
Any idea?
Unfortunately there's no such option available in Viber since version 5.6, according Viber's support.
You can share a message, using Viber, but you can not send it to a specific user: you'll be prompted to select one in you user's list.
The URL scheme is:
viber://forward?text=foo

Build a Windows phone chat app with Post and Get request

I am supposed to create a simple chat app using httppost and get in order to send message and to get message.
This is what I am supposed to get after sending the request to the API:
{"conversation":
{"id":35,"created_at":"2014-11-16T19:21:11.000+01:00",
"updated_at":"2014-11-16T19:21:11.000+01:00",
"conversation_type":null,"option_id":null,
"messages":[
{"body":"lol","created_at":"2014-11-16T19:21:13.000+01:00","user_id":34},
{"body":"payday","created_at":"2014-11-16T19:25:57.000+01:00","user_id":34},
{"body":"lol","created_at":"2014-11-16T20:19:26.000+01:00","user_id":34},
{"body":"izi","created_at":"2014-11-17T01:09:36.000+01:00","user_id":34},
{"body":"LOWL","created_at":"2014-11-17T01:11:34.000+01:00","user_id":34}
],
"users":[
{"id":34,"email":"zegfault42#gmail.com","first_name":"Hugo","name":"Barbier"},
{"id":36,"email":"ismael.bourg#gmail.com","first_name":"Ismael","name":"Bourg"}
]
}
}
And I am supposed to make a post request in order to reply message. I just want to know what I can do and how I can design it.
Please read more about HTTP Post & Get methods, REST services.
It is very simple. You can find it on the internet.
Also, I had similar questions when I started developing.
Check the answer to my question here-
Request & Response Windows Phone
Hope this helps

Can't send push notification to single iOS user on Azure Mobile Services

I've set up my mobile service on Azure and uploaded the development certificate with push notification permissions. I'm using mono touch to the get the device token from the app and sending that up with a request. When the item is inserted I want to send a push to the client but in the logs I keep getting this error
{ [Error: 400 - Invalid expression: '568d4f52 615ee9.......
where the expression is my device token. If I go to the table I can see that the device token matches the one generated in the iOS app. I did upgrade the mobile service to the enhanced push but can't find any examples of how to push to a single user. In my code I have
request.execute();
push.apns.send(item.pushNotificationHandle, {
alert : 'testing',
payload: { text1: 'inner text' }
}, {
error: function(error){
console.error(error);
}
});
The docs on the Azure site seem to be getting pretty stale so I've no idea where the error is and how it should be different. Looking at their server reference docs here I'm not sure why this is failing
http://msdn.microsoft.com/en-US/library/azure/jj839711.aspx#send
Does anyone have any experience with this? I have logged out "item.pushNotificationHandle" and it is a string as expected (matches in the table)
Thanks for pointing out the documentation which has not yet been updated.
Please see this documentation for an almost accurate enhanced push version of push.apns: http://dl.windowsazure.com/nodedocs/ApnsService.html
What you can see is that the send method's first member is tags.
To use enhanced push to target a single user, you should add a unique id for that user the user's tags. Then you send the notification to that specific user's tag. (This feature can also be used for sending to a subset group of users.)

Resources