Does anyone know if Firebase has the functionality for me to email a user with a yes/no question which in turn offers two links, if one of those links are clicked it then changes a specific value on a node in the database?
In my mind I would use a firebase function to email the user when a certain trigger occurs, and the body of that email would be a template where upon the two links can be added as needed.
I have been searching online but either am using the wrong key words or the functionality does not exist..
Yes, you can do this with Cloud Functions for Firebase. Essentially you would want to have two functions: one that sends the email and one that handles the links in the email.
If I were building it, I'd probably generate a secret token when I sent the email and store it along-side the question's data. In the email template, I'd then have the yes/no buttons point to my function URL like:
https://us-central1-myproject.cloudfunctions.net/respond?answer=yes&token={the_generated_token}
I'd then parse the answer and token from the query string in my respond function, verify that the secret token matches, and if so record the response. Once the response was recorded, I'd invalidate the secret token somehow so it could only be used once.
Related
In the FlutteFire documentation, it says that "Firebase will send an automated email to the user with a unique code. This code can then be entered via the applyActionCode() method. You can first check whether the code is valid by using the checkActionCode() method" Yet when I send an email verification, it shows a link.
In my email template on Firebase console, it is still showing an email link.
I want to be able to send a code instead, just because it allows for a better user experience in my opinion. What do I do in order to get the email verification to send a code instead? I've looked everywhere and can't find anything helpful.
At the time of writing, you cannot extract the oobCode value that is generated by Firebase Auth.
If you want to use this code, you need to extract it from the Query String in the web page that corresponds to this URL (note that you can adapt the URL in the template in order it points to another URL that you control, e.g. that is exposed by your app).
Firebase Authentication has a built in email service. Is it possible to fire an auth based email via Cloud Functions (admin js sdk)?
Seems like I should be able to trigger an email from noreply#my-domain.com with a custom oob code which I could then use to drive my (client-side) application.
My use case would be, when a new order .collection("orders").doc(uid) has its stage field updated/changed to 'submitted' I would like to notify a user via email that a new order is submitted. Maybe even use the oob code to mark as 'processed'?
...just trying to avoid using a 3rd party email service altogether.
you can use MailChimp to do what you are asking, since like Miles says, you will need to do a workaround in order to fix this.
I have been using MailChimp my self to send emails to each user registered in my app , i have setup a couple of emails in mailchimp and i just add to the list all the users that register to my app, so the first message will be the welcome message, then after 2 days another email and so on, you can trigger an email whenever you want, since the doc is not that clear i have made a tutorial on how to integrate it with Android.
you can find that tutorial HERE , the only thing is that is in spanish, sorry.
The idea is simple, just get your users email throught FirebaseAuth , pass that email to the mailchimp query , and then setup an email from the mailchimp website
Unfortunately, their API does not appear to support emailing users in your project. However, they have sample code for cloudfunctions to email users you can easily tweak for your needs: https://github.com/firebase/functions-samples/tree/master/quickstarts/email-users
I'd like to set up a authentication through telegram using it's deep linking api.
In order to authenticate, in my app I ask users to click on a link like:
https://telegram.me/myloginbot?start=somesecretkey
If I understand the docs correctly, I should expect the bot to echo back somesecretky to my server.
Now, this step of the docs is unclear to me:
Configure the webhook processor to query Memcached with the parameter that is passed in incoming messages beginning with /start
If I understand correctly, I need to configure myloginbot so that when the user clicks start button on the bot's page, the bot echos back to my server a url containing somesecretkey and some user info. But I don't know how to do so.
In this answer, it is suggested that:
Let the bot retrieve the username by querying the database or key-value storage for unique_code.
But I don't know how can I make the bot query the (presumably remote) database.
So really appreciate your hints.
My understanding to deep linking is this:
You have a database of users. Each user has an ID. Suppose you want your Telegram bot to communicate with user 123. But you don't know his Telegram chat_id (which the bot needs in order to send messages to him). How do you "entice" him to talk to the bot, thus revealing his chat_id? You put a link on a web page.
But the link has to be "personalized". You want each user to press on a slightly different link, in order to distinguish them. One way to do that is to embed user ID in the link. However, user IDs are not something you want to expose, so you generate a (temporary) key associated with each user ID, and embed that key in the link. For example, user 123 has the key abcde. His personalized link will be:
https://telegram.me/myloginbot?start=abcde
Someone clicks on the link, and is led to a conversation with your bot. At the same time (or when he presses the START button), your bot will receive a message:
/start abcde
On receiving that message, the bot sees that abcde is associated with user 123. Telegram chat_id can also be extracted from the message. Now, the bot knows user 123's chat_id, and can send him messages afterwards.
To experiment with deep linking, you need a bot that can handle /start messages, supported by a "datastore" that remembers the key-ID associations. When Telegram docs say "memcache", they just mean something that stores the key-ID associations. For an experiment, it may be as simple as a dictionary, or an associative array. In real life, it may be Memcached (the memory caching software), or a database table.
If you use Python, I recommend taking a look at telepot, a Python framework for Telegram Bot API. It does not do deep linking per se, but it does help you in receiving messages for a bot, and other bot operations in general. I also have an example there demonstrating how to output a personalized link, set up a webhook, and parse the incoming /start command with the key.
I am building an application where in analytics data gets written to Firebase.
This is a plug in to an eCommerce site and there is no guarantee that user would login to the eCom site so identifying using user id is not an option.
Of all the connected users currently online how can I selectively push a notification to a specific user? I have done this before using Node.js/SocketIO. In socketIO world this can be achieved by socket.id which is unique for a socket object.
I am rewriting the app in Firebase , any help is greatly appreciated.
You can identify anonymous users temporarily by randomly generating a string using push(). Once you've assigned every anonymous user with a random ID, you can push notifications to that user by writing data to that user's location using set or push.
The list is displayed in the tab: "Game Requests" or "App Requests". How to get a list to json format?
As far as I'm concerned you can get it only for a specific application, i.e. check if the user has any requests from your application. I couldn't find anything which would return user's all requests.
You can try either https://graph.facebook.com/User_ID/apprequests?access_token=... or
https://graph.facebook.com/User_ID/platformrequests?access_token=... but the latter one must be called with an app secret signed session.