Trigger Request for Slack's Magic Login Email - ios

I'm building a small email app (on iOS first) for internal team use only. We also have a Slack team that I'm rolling out to the whole group (about 250 people) around the same time I'm launching the app.
I'm going to have a lot of older and tech-phobic users, so I'm trying to make things as easy as possible for them. Since I'm writing the email app, I figure to making on-boarding even easier I can:
Check if they've got the Slack app installed (via the canOpenURL method)
Send them to the App Store to download if they don't
Open the Slack app for them if they do
Look for the magic login email
Automatically open the URL from the email.
All that is great, but it would be fantastic if I could trigger sending that email automatically and don't even need to send them to manually put in the team URL and their email. Anybody know a way?
CLARIFICATION:
One big reason I want to do this that I didn't make very clear is that when the Slack app sends the email it prompts you to go to your email app to receive your login link, but since iOS doesn't allow changing the default email app, it will send them to the wrong one for my user's purposes.

Sure. If you already have the emails of your target group you can generate the invitation mails programmatically with a small script.
You will need to use the undocumented API method users.admin.invite for that.

Related

Questions about the Twilio Authy API

We currently have a solution where we implement 2FA ourselves over Twilio Programmable SMS.
We're also using Twilio Verify for Payment PSD2 authorization.
We're now looking to migrate everything to Authy to make use of the Authy app and I have the following questions that I'm hoping you can help me with.
User Migration. I understand in authy, users need to be registered to our application. How can I register all our current users? Is there any way to bulk upload them, or do I have to write a script that calls the API to register them one by one?
User Number phone update. Sometimes our users will update their phone or email in our system. If that happens, how do I update that info in Authy? I couldn't find anything in the docs about that. Do I need to call the api to remove the user and readd with the new info?
Migrating from Verify PSD2 to Authy PSD2. Is the implementation very different? Is there any sample I can look through, as the documentation seems to mainly be talking about QR codes, while what we want to do, is to send it over SMS or Authy depending on the user's choice.
Thanks for your help
Sam
Twilio developer evangelist here.
You will need to write a script to register your users. When you have registered a user, you will receive an authy_id for the user, which you will need to store with your user record.
If a user updates their phone number then you should update the Authy user. To do so, you will want to delete the old user and re-register with the new phone number. You will then receive a new authy_id and you should re-confirm the user can authenticate by challenging them for a new code before you complete the update. If the user updates their email then you can do the same process of deleting and creating a new user though you should receive the same authy_id back if the phone number hasn't changed (though this will add the email address to Authy's representation of the user).
Check the documentation on PSD2 compliant authentication with Authy here. If you are sending SMS messages, then you should set the action and action_message parameters, which tie the message to the authentication. For the app based authentications you can do it via Push Notifications (in which you can include transaction details in the push). If you don't want to implement push, then you do need to get your user to scan a QR code in order to tie the transaction to the authentication (the regular code generated by the app is not connected to a transaction, so is ineligible for PSD2 authentication).
Let me know if this helps at all.

Sending email without showing email composer view in ios 7

I'm making an iOS app and the user has to enter their info to register for an account. I'm wanting to make it so that it sends an email to the provided email account with the info that they just entered. But I don't want them to be able to see the email view. Is there a way to send an email in the background in iOS 7? I'm familiar with the SMTP Gmail workaround but I was wondering if there was anything more generic.
There is no documented API available using which you can perform this.
send this detail to your server via web service and than server will send the email using that detail.

Retrieving and displaying third party Facebook statuses in iOS app

I'm new to Facebook development and I'm running into trouble with what seems like it should be an easy task. I am building an iOS app for a client, and that client wants to display a number of their most recent status updates in the app, along with a link to their Facebook page. These statuses should be displayed to the user of the app even if they are not logged into Facebook or do not have a Facebook account saved on their device.
My research so far seems to indicate that I'll need to make a request to the Graph API using a user access token (which I can do successfully in the app using a token copied and pasted from the Graph API Explorer), but it seems that the only way to get a user access token from within the app is to log the user of the app into Facebook using their account credentials. This is not a good solution because I need to be able to display the client's statuses to the user whether they have are logged into a Facebook account or not. Is such a thing possible, and if so, how? I've been all over the docs and can't find a conclusive answer either way.
I know that we would approach it quite differently. We would have our own web service periodically pull what we needed off of google and store it on our own server, then we would use AFHTTPClient to pull this information down to our app. That way we wouldn't have to spoof anything with FaceBook or put any requirments on our users, such as logging into facebook. It would require that you have a service that your client maintains (or you could easily contract that for a cost).

Parsing and Receiving Email in iOS

Suppose I have an email address that only receives a specific type of email, i.e. an automatically generated receipt email from a transaction.
I would like to build an iOS app to receive the email text from this email address and parse according to a predefined format and display the results. Is it possible to do this without dealing with the email server directly from the app?
Meaning can I for instance piggyback off the native mail client (assuming it is set up to receive pushed email sent to the email address). I tried looking through Apple's docs for iOS but could not find anything useful. Anyone know of something?
3rd party apps have no way to integrate with the Mail app or to make use of any configured mail account the user has setup on the device.
However, you can write an app that can access external email accounts if the user provides all of the usual email account details. The App Store has several 3rd party mail apps that serve as replacements for Apple's Mail app.
If your app is written to work with a specific email account, and not one entered by the user of the app, then you can hardcode all of the account details in the app.
Your app is basically a run of the mill email client. You just have to know how to access IMAP or POP3 accounts, retrieve the emails, and process them as needed.
Again, there is no way your app can intercept or make use of any emails accessed by any email accounts the user has setup for use with the standard Mail app.
There are at least two aspects to your question:
How do I get an email to open in my iOS app?
Put the data in an attachment and see this link
What format can I use in an email attachment to transport persistent
objects?
I've had decent results with NSKeyedArchive as an interchange format. There are lots of other choices, depending on what generates the receipts attachments.
Post a followup with your choices. Good luck!

Way to up incoming and outgoing mail for a custom mobile app

I am used to building apps in larger infrastructures. In a startup, how do I setup SMTP for a mobile app? Is there a place I can use for hosting this?
There are a couple of possible approaches:
One option is to not attempt to interface with SMTP/IMAP/POP servers directly in your app. You can, alternatively, send emails from your app via MFMessageComposeViewController, which gives you a standard compose email user interface. This is very easy to do.
To handle inbound emails you can let the user receive their emails via the standard Mail app (that way users don't have to go to different places to receive their emails). You integrate inbound emails with your app using a custom URL scheme. You can then send the user an email using this custom URL scheme, and if they get the mail on their iOS device and have that app installed, when they click on the link they will be taken to your app, passing it information from the URL in the email.
For example, if you defined a custom URL scheme of yourapp://, you can just include a hyperlink to that URL in your email (or text message or your web site), and if the user is on their iOS device, when they click on that link, they'll be taken to your app. If you google "iOS custom URL scheme tutorial", you'll see examples of the plist entries you need to make in your app for it to respond to a custom URL scheme. The Implementing Custom URL Schemes reference shows you what sort of changes you need to make to your app delegate to actually pass data in your custom URL to your app.
Alternatively, you can (a) sign up with any Internet Service Provider (ISP) that offers mail hosting; (b) write an app that sends email by connecting to that ISP's SMTP server; and (c) retrieve email by connecting to that ISP's IMAP or POP servers. Clearly you'll have to pay fees to the ISP, the quality of your app is linked to the quality of the ISP you partner with (so pick a good one), and you'll have to do your own SMTP/IMAP/POP integration in your app (and you'll have to write your own code to do that or use a third-party library for that, as this is not standard Cocoa Touch functionality). In my opinion, you'd need a pretty compelling business case to go down this road, though it can be done.
You could avoid email altogether, and develop a web service for letting the users send and receive messages. (This might make sense if the app is just sending messages between users of your app, for example.) Again, you'll have to contract with an ISP for web hosting, and you'll of course have to undertake the non-trivial exercise of writing your web service code. But this is architecturally cleaner than integrating with SMTP/IMAP/POP servers if the purpose of your app to facilitate communication between users of your app.
You haven't provided enough information for us to assess which approach best suits your situation.

Resources