Send email automatically every day in App maker - google-app-maker

I need to send an email alert everyday to notify pending Approvals to all approvers. Does this possible in App maker? Please suggest.
I am sending approval emails immediately after request created and this is working absolutely fine.
I want to know the event or an utility in App Maker which can help to trigger emails for pending approvals to approvers every day.

You can achieve this using Triggers in App Makers server script.
Please check the sample code below for more details.
ScriptApp.newTrigger("functionName").timeBased().everyDays(1).create();
You have to create a function which sends the email and add the name of the function in the place of newTrigger("functionName") with the quotes.

Related

Does long-polling work always even if the user switches app?

I have an application which sends notification to its subscribers through telegram.
For someone to subscribe, he needs to add his request in my website and after that, to identify his self, he needs to start a conversation with my bot using a secret code generated by the server.
For example, whenever he completes his request he should click a button which leads him out of my website and to telegram's chat (using ), in the background, the website is making long-pool requests to the server to check whether the server received a notification from telegram with this secret code abcd and to get the chat id assosiated with the request so it could store the request with this specific chat id.
The process seems to work just fine for many users, but for minor amount of users it's not working, they are starting a conversation with my bot but not getting any feedback about a success. It seems as whenever they leave the website (or the browser) and follow the path of the link (https://t.me/mybot?start=abcd) straight to telegram app, the long-pool is being stopped.does that happen sometimes when long-polling?

Mailchimp + Firebase - subscribe to newsletter

I am using Mailchimp and Firebase to send automated emails.
I have installed the extension and it using Firebase Console, but for Contact Status option I chose 'Pending'.
The thing is, I dont want every user that creates an account to be subscribed to the audiance, I want it to be 'Subscribed' just if he subscribes to the newsletter (it should happen on a click event on a button). I have also set up an automated email in Mailchimp (that is triggered immediately after subscribed contacts join your audience).
Do you know how can I achieve this? I don't have any written code yet, because I don't know where to begin with this.

Best way to utilise push notifications when app goes into background

I am a React Native developer currently working on a vehicle tracking app.
We want to develop a feature that allows users to exit the app, but continually be updated in the form of notifications when the vehicle moves (on average every 60 seconds).
I have been tasked with coming up the best way of integrating this. Our app already has push notifications set up with Firebase and we do use this to push out generic messages to the app.
My thinking is as follows:
When a user begins tracking a vehicle, the app should subscribe to a Firebase topic identified as the vehicle's registration. On the server side, each time an update comes in for a vehicle, send out a Firebase notification to that vehicle registration's topic, and then any users tracking it will be updated. When a user returns to the app and presses 'Stop tracking', the app unsubscribes from the topic.
In theory I think this would work. The reason I'm posting is I'm not sure it's the most efficient way. Our server received updates for over 1,000 vehicles every minute.
Any help/ideas would be gratefully received!

Check when any user is connected slack API

I want to know when any user is connected to my slack workspace. I know that with presence_change event I can get that info, but passing the user ID.
What I want to achieve is to send an event to my app (right now using ngrok) when any user is connected (eg. it status changes from disconnected to connected)
EDIT:
Finally I discovered that if you listen that event without user_id, it will returns the ID of the user that triggered that event. If this help anyone.
I know you already answered you own question and it's kinda old now, but it could help others.
Here is what could be done:
create a slack app
enable event subscriptions for this app in order to call your application webhook each time the 'presence change' event happens
in you application code, call slack api to get more details about the user that triggered this event
I detailed how to do these steps in this blog post for a very similar use case, but for another slack event (bot events), if needed: https://blog.eleven-labs.com/en/en/replace-erp-by-slack-bot-with-dialogflow-and-symfony/

How can I test subscription renewal flows in stripe?

I want to test my application's handling of webhook events from stripe when a subscription payment has been made (or failed). Here is what I've tried so far:
Set up a new subscription
Update user's credit card to be the one that can be added to an account, but will fail to actually be charged
Change the trial end date to be in one second
Wait a few seconds expecting the webhook to be sent
However, According to the documentation:
If you have configured webhooks, the invoice will wait until one hour after the last webhook is successfully sent (or the last webhook times out after failing).
One hour is a long time to wait, since I am trying to do this as part of an automated integration test suite.
One suggestion (from IRC) is to fake out the webhook request, so that my integration test sends the event, instead of Stripe sending it. However, since Stripe doesn't include any sort of HMAC in the webhooks, I can't trust the data in the payload. So, my application just takes the event ID from the webhook payload and fetches the event from the Stripe API:
If security is a concern, or if it's important to confirm that Stripe sent the webhook, you should only use the ID sent in your webhook and should request the remaining details from the API directly.
This will obviously not work if I am trying to inject fake events for my test (by design).
What are the best practices for testing this sort of scenario?
It seems there isn't a perfect way to do this. As suggested by #koopajah in a comment, I added a configuration value in my application that will disable fetching the event from Stripe, and instead just trust the event data in the webhook. This allows me to test my flow in almost the same way as it would work on production, since the event data in the webhook and the event fetched from Stripe are identical (assuming it is an authentic webhook request :)
Unless/until Stripe includes an HMAC signature in the webhook request to authenticate that it came from them, I think this is the best way to solve the problem.
One hour is a long time to wait, since I am trying to do this as part of an automated integration test suite.
You can shorten the wait by going to the invoice and selecting the "Charge customer" button, as shown below.

Resources