How do i invoke a Microsoft Azure Scheduled Job from my serverside code?
I have a running Scheduled Job, that calls an endpoint, to send out some emails and sync some data.
I have a system, where users can send emails out to lists of emails. So instead of the user waiting xx minutes for a response from the web server, after it is done sending out emails, I would like to just call my Scheduled Job, so that the user can initiate the email sendout, but doesnt have to wait for it to finish. Sort of "Fire and forget" for the user.
How do i go around to do this? I haven't been able to find any info on how to achieve it.
Thanks in advance.
Update:
I found this documentation right after posting:
https://learn.microsoft.com/en-us/rest/api/scheduler/jobs/run
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}/run?api-version=2016-03-01
I am however not able to find info on how to authenticate against this endpoint. But it seems like its definetly possible to do.
I'll leave the question/answer be, in case it can help anyone.
It turned out that using the azure endpoint for a Post call to invoke the scheduled job, was a good solution.
After setting the resource group and jobcollection up correctly, I got it working.
https://learn.microsoft.com/en-us/rest/api/scheduler/jobs/run
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler/jobCollections/{jobCollectionName}/jobs/{jobName}/run?api-version=2016-03-01
Related
I’m having a problem with a bot that has to reply automatically when a message is posted in a Teams channel. When it is activated, it also responds to messages that were posted prior to its activation. How can i avoid this ?
Thanks for your help
I'm assuming you're running a flow with a Microsoft Teams trigger.
I can see two possible causes of this.
This first is that Microsoft's Team trigger doesn't work very well and is firing for previous posts while the Flow is disabled. Very plausible
If that's the case you need to make a Condition to check if the post date is greater than the current time minus say 10 minutes, AddMins(UtcNow(),-10). If successful, continue, if not, terminate.
Hopefully, you can pull the post date directly from the Teams trigger, but if not you'll have to use a Teams action to look up information about the given post id provided by the trigger.
The second possibility is that you're not taking the ID from the trigger which will tell you what post to respond to, and accidentally doing some kind of reply to all posts in the channel.
The use-case would be to trigger certain jobs, only after an MR is not in WIP anymore.
The idea what I'm exploring is to create a merge-request webhook, that would trigger a pipeline.
However in order to do this, I have to get the ref from the webhook's request body to call the trigger accordingly.
What options do I have?
Running a server just for processing the webhook and redirecting to the correct endpoint is not really an option.
Running a server just for processing the webhook and redirecting to the correct endpoint
I dont see any other way. I'm in same boat. Gonna use Heroku for just this bit. Oh well.
Is it possible to add a setting on Cronitor that sends an email once a cron job succeeds. Right now I only get email if a cron job fails.
This is what i have at the moment :
Alert preferences Failure tolerance Duration alerts
Alert notes
(X) Send alerts any time there is a problem
() Only send alerts if my job has consistently not run when expected...
I tried to email/contact support but now answer from Cronitor yet.
I'm one of the creators of Cronitor. I'm really sorry we somehow missed your support inquiry.
The answer is that, yes, this is possible but you cannot set this up without an API call. After the initial setup is complete (and the new alert rule is added) you can continue managing the monitor from the dashboard.
If you email support#cronitor.io again with specifics I can help you with adding this rule via the API.
I found a similar question from 2016, however at that time Gmail itself did not support scheduled sending of emails.
Now that you can schedule messages to send later directly from Gmail, I was wondering if there was a way to do it with their API.
Interestingly, scheduled emails appear as message objects when calling messages.list, but they do not contain any labels.
Any help would be appreciated! And if it's not possible at the moment, it would be awesome to get a reply from someone at Google about when this will become possible (I believe they officially endorse the gmail-api tag to StackOverflow)
I don't think a time-based trigger will work--even if you write the code to store email send data and then build something that regularly checks whether it's time for an email to be sent. See Google's documentation on triggers, and you'll notice that time-based triggers aren't available for Gmail scripts.
Unfortunately, there is no Gmail API endpoint for scheduling the sending of emails directly.
One workaround would be to write a script in Google Apps Script (https://script.google.com) which handles the composing of the email you wish to send, as well as a function to send the mail via the API. You can then use the built-in 'Apps Script Project Triggers' feature to trigger the function to run on a schedule; for example on action/event or at a specific/repeated time.
Button for adding trigger to Apps Script
We use Salesforce and Google Apps.
We have a Google Apps Email account that accepts an email and forwards this on to Salesforce, where Salesforce creates a case.
The last 2 fridays, we have had problems where it can take over 3 overs for an email to make its way into Salesforce.
How do I find out if the problem is with Google Mail not forwarding the email on in a timely manner, or the problem is Salesforce not processing it in a timely manner?
Anyone else ever had this problem?
Thanks!
A few ideas, which you may have already tried:
1) You could check the timestamps in Gmail to see when the emails were received and then forwarded to Salesforce to see if there was a delay.
2) You could check the dates against the Salesforce system status page to see if there were any reported issues: http://trust.salesforce.com/trust/status/
3) Same for the Google Apps status page: http://www.google.com/appsstatus
4) Check to see if there were any other delays in Salesforce or concurrent batch jobs that might have caused the delay.
5) Submit a support request to Salesforce to inquire.
Hmmm. Are you using Salesforce Email to Case? Here's someone posting a similar question: https://success.salesforce.com/questionDetail?qId=a1X30000000IGwWEAW. It seems that at the time that both problems were a temporary outage on the part of Salesforce. Also, are you using any apps to integrate Gmail and Salesforce? Because apps like The Scoop Composer allow you to forward emails and create cases right away. http://www.cloudgizmos.com/salesforce-gmail-integration. Hope this helps!