For the IoT edge function, input trigger is edgeHubTrigger and the output is edgeHub. How can we send email in IoT edge using function? And will this be suggested approach to do in IoT edge or we need to send to IoT Hub and the listener function (in the cloud) listens to IoT hub send email?
If your Edge device, and your Edge function, have access to a mail server (or a service like SendGrid), then sure, you should be able to send emails. You should be able to use any .NET SMTP client library (or again, something like Sendgrid with their SDK).
If I would consider it a great design to send mails from the Edge device? This depends a bit on your scenario I would say: If you want to use some on-premise mail server, which is reachable from your Edge device but not from the cloud, then this might be a valid approach.
But if you use a mail server that you reach over the internet or some cloud mail service, then I would probably rather send those messages from the Edge to the IoT Hub in Azure (and put a property on them for routing), route them to an Azure Function and send them from there. This way you avoid putting your send logic onto each and every Edge device. Plus you automatically benefit from the message caching of the Edge Hub in case your Edge device is offline for a while.
Related
I have a BOT running which reponds to api/messages URL from the BOT Framework Emulator, and I can send text to it.
However what I need to do is write an application which sends text to the BOT over this URL. That is basically does what the BOT Framework Emulator does when I enter text and send it, probably over the graph API.
I am aware of information which demonstrates sending to a chat in a channel, but I just need to send to the BOT itself.
Can anyone advise how I can do this, or is there a suitable sample which demonstrates it.
Thanks
At the end of the day, your bot is really just a web api endpoint. If you set up a tunneling service like ngrok, you can use it's built-in web viewer to see the traffic that is sent to you bot, e.g. via the emulator or even via the azure bot registration page (there is a similar emulator built into the page in Azure). Once you've seen that traffic, you can essentially just mirror it from whatever you want to call from - it's essentially a json payload.
However, considering your bot is just a web api, I'm not sure why you want to "call" your bot from another app. Why not just make another endpoint that you can use for app-to-app communication (like a normal api endpoint). You can then refactor your code so that whatever you need to do can be done either via a bot message OR via the API call.
Rails 6 comes with Action Mailbox now. The documentation and community do not have great resources on how to integrate various services outside of the most common such as SendGrid.
Assuming a person uses Google's Gsuite Gmail:
How could they integrate that with Action Mailbox?
Would one use Gmail's API, or would that not be appropriate for Action Mailbox?
If Gmail doesn't work, what is different about SendGrid that makes it integrate appropriately?
Action Mailbox is built around receiving email from a Mail Transfer Agent (MTA) in real time, not periodically fetching email from a mailbox. That is, it receives mail sent via SMTP, it doesn't fetch mail (using IMAP or POP3) from another server that has already received it.
For this to work it is dependent on an external (to Rails) SMTP service receiving the email and then delivering the email to Action Mailbox. These external services are called "Ingresses" and, as at the time of writing, there are 5 available ingresses.
Of the five, four are commercial services that will run the required SMTP servers for you and then "deliver" the email to your application (usually as a JSON payload via a webhook).
Mailgun - scroll down to "Inbound"
Mandrill
Postmark
Sendgrid
You could already use those services in a Rails App and handle the webhooks yourself but Action Mailbox builds a standardised set of functionality on top. Almost like a set of rails to guide and speed the process.
In addition, the fifth ingress is the "Relay" ingress. This allows you to run your own supported MTA (SMTP server) on the same machine and for it to relay the received email to Action Mailbox (usually the raw email). The currently supported MTAs are:
Exim
Postfix
Qmail
To answer your specific questions about Gmail:
How could they integrate that with Action Mailbox?
They couldn't directly. They would need to also set up one of the 7 MTAs listed above and then somehow deliver the emails to that. The delivery could be accomplished with:
Forwarding rules managed by the user at the mailbox level
Dual delivery, split delivery or some other advanced routing rule managed by the admin at the domain level
Would one use Gmail's API, or would that not be appropriate for Action Mailbox?
Even if there were a way to have Gmail fire a webhook on incoming email (I'm not aware of any special delivery options outside the advanced routing rules above), there is currently no way to connect that theoretical webhook to Action Mailbox.
If Gmail doesn't work, what is different about SendGrid that makes it integrate appropriately?
Sendgrid (to use your example, the others work more or less the same way) offers an inbound mail handling API. Just as importantly, the Rails Team has built an incoming email controller to integrate with that API.
Given the lack of Gmail APIs and the lack of a Rails ingress controller, the only way I can think of that you could connect Action Mailbox to an existing Gmail mailbox would be for some other bit of code to check the mailbox, reformat the fetched email and then pose as one of the supported MTAs to deliver it to Action Mailbox.
It would be an interesting exercise and would possibly become a popular gem but it would very much be a kludge. A glorious kludge if done well, but a kludge nonetheless.
Another option would be to leave your example.com domain delivering to Gmail as normal and set up another domain for your Action Mailbox emails. You could use a separate domain, example.org, or a subdomain, app.example.com.
This would involve setting up one of the 7 supported SMTP servers and pointing the MX records for example.org or app.example.com at those servers.
Bonus trivia: Another name for an MTA is a Mail eXchager, hence the name for a DNS mail record is an MX record.
To integrate IMAP with Rails, have a look into the greate mail_room Gem
It's a daemon that you can start alongside your app, which listens onto couple of IMAP inboxes, and then convert those into either a Sidekiq Worker or push it via http to your app.
It's used by Gitlab for their mail interactions (Answer to thread, create issue by writing to an email).
They also have a section on how to integrate with ActionMailbox.
If you were dead set on doing this, Gmail has had IMAP IDLE (push) support since day one.
It would be quite easy to write a small daemon that watches a Gmail inbox and calls the rails action mailbox webhook endpoint with a properly formatted JSON payload.
As I looked into Google's references about smart home, I got to know that Google Home connects directly with the end device. But I wanted to specifically connects it with my gateway and sync with it so Google Assistant would only need to send command to the gateway to fulfill a user's request like "Turn on the light". Is this possible or Google need to connect to every end devices for it to work?
If you want, you can create a Hub device that talks to the Cloud and acts as a gateway to smaller, low-powered devices. In that case, you would still return all of your devices in the SYNC response but then handle all of the EXECUTE requests in your Cloud by forwarding to the Hub. From there the Hub can handle it however is needed.
From what I read, Microsoft Edge still does not support Web Push (it is still under development, as per site ). So what is the best way to implement browser push notification for Microsoft Edge?
The link - https://learn.microsoft.com/en-us/microsoft-edge/dev-guide/device/web-notifications-api - explains how we can send from a Javascript. But am trying to understand how I can send a notification from a different server side component (Java), to Microsoft Edge browser? Do we get any tokens like how we get when we use FCM in Chrome? Can someone provide me pointers on this? The application running on Microsoft Edge will be an angular 4 app.
You need to use the Javascript Fetch API, AJAX, Long Polling, WebSockets or SSE. Once you get the notification on the client side you can use vanilla Javascript and the Notification API to display the notification.
We are using IBM Push-Notification service and Mobile-App-Security on our Bluemix app (serving iOS clients).
In order to send a push notification, our server sends a POST request to: https://mobile.ng.bluemix.net/push/v1/apps/{application-id}/messages
with the application secret in the Ibm-Application-Secret header (following the instructions here).
To initialize Mobile-App-Security SDK inside our app you need both the application-id and the application-secret - this means that the app itself must contain these values (as constant parameters or download it from a server). If a malicious user fetches these values using simple reverse-engineering, he would be able to send the same POST requests, i.e. send push notifications to other clients, right?
Shouldn't there be two application-secrets? One secret for the app (making it hard to fake registrations - i.e. require reverse-engineering) and one for the server (which allows to send notifications and should never be stored on client-side).
Is it possible to initialize the Mobile-App-Security iOS SDK without an application secret?
I understand your concern. To address all your questions:
-You must have the app secret on the Client side in order to authenticate with MAS and use the Push service (Push relies on MAS auth)
-We recommend implementing your own form of security to prevent a malicious user from easily obtaining the App Secret. For example, encrypting the file that stores the app secret, or just the app secret itself.
If you are looking for a more robust built-in level of security, I would recommend using the newer MobileFirst Services Starter, with support for Push and the Advanced Mobile Access service (AMA), which is currently only available for iOS 8.
A mobile device registers with its unique device id at the server running on Bluemix. If you don't trust a device, you could send a push notification with a key to this device and request it back. If you get this key back, the device has also registered at Google or Apple successfully.