Send SMS / Email from Watson Assistant (Converstion) - php

I am currently developing a little chatbot using IBM Watson assistant.
While I'm quite used to entities and intents etc... I really lack experience on how to link to bot to external services.
Long story short, my bot will ask for a phone number and an email address, but I can't get my head around on how to make the bot communicate with the outside world.
I have a Twilio account for, but I can't find any doc on how to send a message from the bot without going through Node-Red (and also in that case the docs are scarce).
For Emails, I thought I could use this, maybe calling a PHP file with Emailer?
Consider that the bot is integrated with Wordpress right now, using only the Watson assistant credentials.
Thanks a lot in advance for your help

My 5 pence advice:
run node-red in the cloud (see the bottom left section of page https://nodered.org/docs/getting-started/). E.g. I recommend the Node-Red Starter Boilerplate on IBM Bluemix (which is now called IBM Cloud) as you are already using the IBM Cloud service "IBM Watson Assistant".
Within node-red, you have specific nodes for the communication with IBM Watson assistant, email, Twilio.
Somehow you must integrate node-red (not Watson assistant) with Wordpress if that is what you want to use as conversation interface.
In IBM Watson assistant you can set context variables containing the phone number and email address that has been gathered during the conversation.
The node-red application has access to the data in those context variables (see the previous point) and can use that, for instance, to send an email to that specific address.

Related

Google App Engine PHP script to process email and send data to a Google Sheet

Our water district sends out automated alarms and process statistics from a SCADA computer in our water treatment plant. The information is sent in the form of SMS messages and daily emails with csv file attachments. Because we also have an informational website on Google Sites, I would like to automatically display real-time process statistics on our website in a simple Google sheet which would be automatically updated.
I have been handling the SMS alarms through custom PHP/Twilio scripts which are separately hosted, but would like to integrate everything in the Google Cloud with Google AppEngine. I think this can be accomplished in a variety of ways, and am currently evaluating alternative automation approaches using PHP and the Gmail API. As a Google Cloud/AppEngine noob, I have a couple of architectural questions:
Can I accomplish this automation by simply enabling the Google Sheet for incoming mail and processing the data through spreadsheet scripting? If I elect this approach, can the Google Sheet receive email directly, or must I send email data to the sheet as an http request?
Alternatively, would the Google Cloud be a more reliable and robust platform for this automation? From the examples I have seen, it looks like AppEngine PHP scripts can be enabled to receive incoming email, parse required data from the email body or attachments, and form an appropriate web request directed to the Google Sheet endpoint. Under this approach, Google Sheet scripting would be minimal.
Does anybody have any constructive advice before I plunge blindly and lustfully headlong into this project? Thanks.
To answer your questions:
1/ Using Google Scripts
I think using Google Spreadsheet Scripting might be an option if your data was stored in the body text of the e-mail.
In this case you could actually write a Google Spreadsheet script which pulls the e-mails directly from your Gmail account. Instead of sending the e-mail to the spreadsheet you could access your Gmail account the GmailApp service.
However ... if you data is stored inside a CSV attachment I'm not so sure if this is feasible. I'm not sure that you can access the data inside attachments with Google Spreadsheet script.
2/ Using Google Cloud
I'm by no means an expert here. But I think you don't really need to host your code with them. Once you use PHP and leverage the Google APIs (Gmail + Google Sheets) you should be able to host your code anywhere you like.
Extra: Consider using an Email Parser Software
Developing all this yourself is feasible it will take you for sure a lot of time. E-mail is always a bit difficult to handle and you have a lot of moving parts there.
I'm the founder of mailparser.io and I believe that you would be much better of using a ready made e-mail parser software like ours for this job. We integrate natively with Google Spreadsheets and you should have something running within a couple of minutes.

Do I need to make 2 different applications for using GCM in android?

I tried searching these issues. Some sites say I need to do some stuff with php in order to make 3rd party server while others don't mention anything. some says it need JSON. Guide me please. PS I am a beginner and know java, XML,SQL only.
You should only need one server. The second server you are reading about may be the Google GCM cloud server? When I did a GCM project a few years ago, I had one server, it happened to be a App Engine instance. It generated events and sent them to Google via the GCM api and then onto onto the device. I don't remember it being that difficult.
I did have more than one server in the mix though, there were others that sent messages to the AppEngine server, but it was not required to send a GCM message.
Google Cloud Messaging (GCM) is a service that enables developers to send data from servers to both Android applications or Chrome apps and extensions.
So if you want to send data to the users of your App then you must have an interface or dashboard from where you can send some data (typically push notification) to the users of your app.
This dashboard (server from which you can send data) can be developed by using PHP or any script languages.
Now a though can come up in your mind:
"I am suppose to develop both the mobile app and the server then what
role does GCM play?"
Yes, GCM is playing a vital role indeed. The server we have to develop is just to design an interface so that you can type your message/notification and select the recipients. Rest of the part of (managing the queue, communication with the apps checking for authentication and all other stuffs will be done by mighty GCM )
In order to have an bird-eye overview you can take a look on this image collected form android hive
Server side coding is doesn't need you to be expert in php. So you can go through to this article. It helped me a lot to learn.

Create web service for notification purpose?

I have built an ecommerce website in CakePHP and MySQL which takes orders and stores them in db. I've been told that I need to create a web service for sending notification to desktop/via email which would alert us of any order given instantly and would also provide us with order details. Do i need to study up on web services, SOAP, GET POST etc. or can I do it with some easier method? What would be a secure and fast response way of receiving such a notification from the web application? Thanks in advance :)
A webservice would be useful the other way round. If a third-party entity wishes to access your website as a service without accessing HTML pages, yes in that case, creating a webservice on your end will be useful.
I recommend you for instance to see the RESTful webservice interface to stackoverflow/stackexchange itself to understand this concept: https://api.stackexchange.com/docs.
In your case, I can't see how webservices would be involved. If you just need to send emails from your website, it can be done directly with the PHP mail() function, or using a mailer like PHPMailer.
Desktop notifications are an entirely different matter, because you need a client software.
I haven't dug pretty far in that topic myself, but here are a few pointers:
A popular Desktop Notification software for MacOSX is Growl which has been unofficially ported to Windows: http://www.growlforwindows.com/gfw/
There is a PHP API to send messages to Growl clients: http://clickontyler.com/php-growl/.

How does linkedin import contacts from outlook?

Linkedin has a feature that allows users to enter their outlook credentials and imports their outlook contacts.
I am trying to emulate this functionality, in a php application.
So far, the only way I have discovered on how this might be done is through Exchange web Services. https://emailhost/EWS/Services.wsdl I am using the php-ews library to try and connect to ews.
I was hoping for some sort of information on a defacto way to retrieve contacts given a users credentials, but have been unable to find much information on this at all.
Are there any other ways that this could be accomplished other than EWS? Does anyone know how linkedin is doing this?
Given that this feature works for a random end user, I don't think LinkedIn connects to Exchange (through EWS or any other API), but to the Outlook instance on the users' machine.
Accessing Outlook objects on a local machine can be done in any programming language through old-fashioned OLE automation. This will also let LinkedIn retrieve contacts for accounts connected to other servers, like e.g. Lotus Notes. (Although I cannot confirm that LI actually does that).

saving website contacts on iCloud

Wondering if someone could give me some advice, I am building a CRM for a client, and one of their "like to haves" is that if they create a new contact they would like the contacts details be both stored in the database but also sync with there iphone/ipad address book.
The only way I can think of doing this is if iCloud offers an api, is this something that could be achieved, or are there any other solutions that maybe could help me.
The CRM is being built on PHP if that makes a difference.
Use Google Contacts API https://developers.google.com/google-apps/contacts/v3/ and set up Gmail as Exchange server on iOS device.
The iPhone supports calDAV (calendaring) and cardDAV (address book) protocols for shared calendaring and address book features.
PHP client implmentation as part of roundcube: http://www.crash-override.net/carddav.html
Open source calDAV and cardDAV implementation: http://www.davical.org/

Categories