How to create parameterised webhook url on gitlab? - gitlab

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.

Related

Quire webhooks API

I have difficult to understand how webooks works. From documentation (https://quire.io/dev/api/#webhook) there is a section about Notification, and so:
"If the app wants to receive notifications of a specific projects or tasks, it can follow the projects or apps by sending a PUT request to the URL. To add a follower, the body of the request can be"
First question: Where should i send the put request?
What i want to do is to send task creation (and edit) on a specific nodejs server (listening over https). I have added my server url to "webhook" section in my app settings.
Second question: If above step is correct, what are the next steps?
Thansk, Nicola
1) the PUT request is sent to the resource you want to follow:
e.g. to follow an existing task you have to update a task using the addFollowers parameter
Four your case you'd have to follow a Project and see filter the notifications are posted to your webhook endpoint.
More detail was given in this duplicate question in github
2) next steps would be to implement your webhook endpoint and listen to notifications.

Hobspot webhook issue

I have developed HubSpot integration using nodejs, I have set a webhook in hotspot as tutorial provided by HubSpot. Now the issue is: webhook is not firing from HubSpot to my server URL, if I test the webhook URL with POSTMan it works fine
I can think of 3 issues that might be causing the problem:
The workflow is not really active.
The workflow is active, but the rules to trigger the workflow are not met.
The workflow is active, but the webhook is not firing successfully. You can check the logs of the workflow by going into its "History" tab.
The workflow is being triggered, but not immediately. This does happen frequently; we have seen times where the workflow takes hours to trigger.

Customize GitLab slack integration messages

Is it possible to change the automatic slack notifications on "Receive event notifications in Slack"?
For example, if a pipeline has successfully completed, we get the following message from the Webhook:
User/Project Name: Pipeline #269 of tag Ticket_8088 by User-Name
(User) passed in 12:02
The form of the message should be different.
I am the server administrator. So I can also change something at the code level. (if required)
There isn't a programmatic way to accomplish such task.
All messages are hardcoded in app/models/project_services/chat_message (as you can see in the repo).
So, in your case, you need to change the method activity in app/models/project_services/chat_message/pipeline_message.rb - please consider that your changes will be discarded when you update GitLab.

How to invoke Azure Scheduled Job by a webrequest

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

"Request a Web Hook" Form - Filters?

The Evernote documentation on web hooks states the following:
If your service only cares about some notes, we can configure a filter on your API key. Notifications will only be sent when the note matches the filter. For example, the filter resource:image/* causes notifications to be sent anytime a note containing at least one image attachment is created or updated. The filter is configured on your API key, so it is the same for all users. The filter string supports our full search grammar.
This is great, except that the Webhook Request form doesn't have any input to specify a filter.
How do we make a request with specific filters?
If we have multiple environments (dev, stage, prod), is it okay to make a request for the same API Consumer Key but for different URLs?
I got a response to my webhook request via email, at which point they asked if I needed the webhook to point to the sandbox or production environment. In my response, I also mentioned the filter I would like applied, and they proceeded to make the webhook the next day. Overall it took about a week and a half to get it setup.

Resources