Phabricator tasks and assignments via Zapier - webhooks

This seems very niche but I have a working system that I would like to simply add to.
Currently, I've a command in a game I've written call a simple Zapier url. Lets say, https://zapier.com/xxxxxxxx?name=me&message=hello%20there&location=location.
When called, it posts the name, location, and message to a discord channel. I would like this to e extended.
What I would, ideally, need is to figure out how Zapier could create a new task in Phabricator manifest titled something like "Bug 231" with the context including name, location, and message, and put it on a projects workboard under a specific category and assign users to it.
I feel like this is possible but cannot figure out the proper syntax.

Zapier itself can perform extra actions out-of-the-box with "Multi-Step zaps". You could add an action after your Discord step to create a Phabricator task.
But, it looks like there's no Phabricator integration on Zapier. If Phabricator has a web API that allows for task creation, you can plug that into Zapier via either:
a "Webhooks by Zapier" step that makes the request
a "Code by Zapier" step if extra processing is needed
a custom Zapier integration w/ Phabricator if you anticipate wanting more actions than "Create Task"

For those seeking similar, I found a way that worked for me :
1- I used https://www.freeformatter.com/json-formatter.html#ad-output to help me with Phabricator's interesting requirements.
2- I went in to conduit / maniphest.edit and used this JSON in the first field to get my desired curl output : [{"type":"title", "value":"test title"},{"type":"description", "value":"This is the description."},{"type":"projects.set", "value":["PHID-PROJ-4dufje6oug3liomahstg"]}]
I took the curl it gave me and put it in here : https://curl.trillworks.com to turn it in to python.
I put the python in to the Zapier python module, replacing text in several places with the variables that Zapier provides.

Related

Using URL Links to Modify Asana Tasks

We are using a read only Asana "Project" to manage our design work. Our design work is organized as Asana Tasks. Each Task represents a different design project. The reason for making it read only is to limit Asana users from accidentally making changes to the project details and to restrict Asana users from creating their own tasks that fall outside of the Task standard structure that we have decided on.
To create these tasks in Asana we are using a combination of Cognito forms and Zapier to create the tasks automatically. Our customer fills out the Cognito form and Zapier automatically populates Asana with the design Task that needs to be completed for that specific customer.
The issue with this setup is that to move the tasks around in Asana to provide the team with "updates", either an Asana user with write privileges needs to do it, or the Asana user needs to fill out a form to make the change, since they only have read privileges. We would prefer to keep it super simple and I have figured out a way to do it using Zapier webhooks.
Because we are using Zapier, I can format URL links in any sort of way I want. I can create a URL link that includes the Asana Task ID and the Asana section that the task needs to be moved to. Using webhooks, a user can click a "Change Section" URL. Clicking this URL will trigger a Zapier Zap action which then will change the Asana Task Section. Just by clicking the link a User can make updates to that task.
My question is fairly basic. Is there a way to stop the URL from opening a page but for the data in the URL to be still passed to Zapier? When a user clicks the link it opens a web page and I don't want that to happen. Or if it happens, could the web page immediately close after opening?
The short answers is "no, it's not possible to click on a zapier link and have the page not open or auto-close" out of the box.
The long answer is a little more involved. I'm assuming your url looks something like https://hooks.zapier.com/hooks/catch/1234/abcd?name=john&cool=true, allowing you to pass "name" and "cool" into Zapier.
To pass that into Zapier, you need to get the contents of that URL, either by loading it in a web browser or calling it with another tool (such as fetch or curl).
If you've got some engineering resources, you could host a very simple HTML page somewhere that could accept data and run some Javascript. It would do something like:
read Zapier webhook url from the querystring (probably worth encoding)
On pageload, run await fetch(thatUrl)
Instruct the user to close the page (which is better UX than the JSON or black response you get from Zapier). I thought JS could close any page, but it turns out window.close() only works if the script opened the page (docs).
So that's an ok workaround.

trigger AWS Lambda function via MS teams

Is there a way we can trigger AWS Lambda function from Microsoft Teams. what I wanted to achieve is that stakeholders be able to approve merge requests from MS teams or maybe give an approval on Production rollout.
Is this connection possible at all?
Please help
Yes, this is definitely possible, but there are a bunch of things you need to do to get a full working solution, so it's hard to give it all in one answer here. Here are some guidelines to get started though:
You need a something for the user to actually "Approve", and way to do this. A common approach is to send a "Card" to Teams, which can have an "Approve" button. There are a few different kinds of cards, and different ways to send them to Teams, including a Bot, Flow/PowerAutomate (which uses it's own Bot behind the scenes) and incoming Webhooks.
When the user clicks the "Approve" (or "Reject") buttons, you need a way to handle the action (to link the button click to AWS).
If you've built Bots before, this might be the easiest option. If you want to use Flow/Power Automate, that's another option (see here for more information about important changes due "this quarter" - I'm not sure if they're released yet). If you've not used any of these, your best bet might be:
Configure an Incoming Webhook
Send a Connector Card with a "Post" button
Set the POST url to be your AWS Lambda

How to implement cards in a QnA question which has follow up prompts and uses them in the cards

I've set up a simple QnA bot which is linked to a QnA service. Within the QnA service I have set up some questions which have follow up prompts(Dependents) e.g. how do I get to a campus, via bus, train etc. see image in link, within the Qna maker testing function you can just click a button called enable mutli-turn which provides functional buttons to inform you of what can/should be asked next via the dependents of the answer See image in link.
However when used within a channel/in the emulator nothing of the like appears see image, which is a bit odd. And obviously I want to implement such functionality in to the bot as it makes life so much easier for the users.
I am new to the whole bot thing(I started last month), so I have a browsed the internet to see what I could find but I could not see anything out side of writing the questions within the bot it self, see Microsofts documentation, which makes using QnA maker pretty much pointless.
What I think I need to do is intercept the message from QnA maker as it replies to the user, look at the Json received to find if has any dependents then run a different dialog, which gets the contextual dependents names and runs a simple for loop generating cards for each dependents, then send the message to the user with the generated cards, however I'm not sure how to intercept the Json and look for any dependents, or there is a button the I need to click within azure which just does it.
There is this experimental sample that has been released by the Bot Framework team which demonstrates how to handle follow-up prompts.
You can download it (you will have to download the whole repo) then plug in your details to the appsettings.json file and you should be able to test it using the Bot Framework Emulator - these were the only steps that I had to perform.
The key part is this method which checks to see if the result contains any prompts and returns the response accordingly - it is called inside the FuctionDialog.
If you're only ever going to be implementing a single level of prompts i.e. you have a question which shows prompts and when you click on one of these prompts it will display an answer rather than taking you to another prompt, then it is possible to take the guts of the logic from the ProcessAsync method (checking for prompts) along with the required classes from the Models folder and the CardHelper class and get this to work in your existing application - you won't have to worry about the QnABotState because you'll only be going a single level deep so you don't need to track where you are in the series of prompts. e.g.
var query = inputActivity.Text;
var qnaResult = await _qnaService.QueryQnAServiceAsync(query, new QnABotState());
var qnaAnswer = qnaResult[0].Answer;
var prompts = qnaResult[0].Context?.Prompts;
if (prompts == null || prompts.Length < 1)
{
outputActivity = MessageFactory.Text(qnaAnswer);
}
else
{
outputActivity = CardHelper.GetHeroCard(qnaAnswer, prompts);
}
await turnContext.SendActivityAsync(outputActivity);
Could someone please advice where do we add this code mentioned above? I am a rookie, have very basic knowledge about programming. Using visual studio with C# for this. How and where do I add this code to make it work? I am also not diving too deep. Just trying to make some simple logic where a user clicks on a few follow up prompts and is taken to the required information. Would really appreciate if someone could help. Thanks
First picture shows the starting follow up prompt.
Second picture that follows the first followup prompt

Count matching phrase message Slackbot via Zapier

I am trying to create a Slackbot that responds to slash commands, counts the number of times a given phrase occurs in a certain channel after a certain date. I have successfully set up a Zapier pipeline that captures the request, formats a search, and returns a result. Something along the lines of:
in:#[channel] “[searchText]” after:[dd/mm/yyyy]
It seems that Zapier's Slack search integration can only return a single message. Is there a way to get the count of messages I am seeking through Zapier or an alternative approach.
I could do this through a python script but I want deliver response as a Slackbot. Zapier's code app states:
Unfortunately you cannot require external libraries or install libraries commonly referred to as "pip modules".
Which prevents me from writing a python snippet within Zapier as the code would need to use slackclient.
David here, from the Zapier Platform team.
slackclient is just a wrapper for their (quite full featured, IMO) API. To use its functionality, you've got a couple of options:
If you're comfortable writing javascript, create a custom private app with a "search message and count" action. You can use the slack JS sdk (since the CLI can use npm modules) or use the included z.request to write API code. Then you can return whatever data you'd like. If you go this route, you can get started with the template.
If you want to stick with Python, you can use the request module (docs here) to make the aforementioned Slack API calls yourself.
Hopefully that points you in the right direction!
If you want to develop your own logic: Here is how to count the occurrences of a phrase within a channel:
Retrieve all messages in a channel within a specific timeframe by calling the API methodconversations.history.
Go through all messages and count the ones that contain the phrase

Slackbot triggering actions and other bots

Slackbot can be configured to respond something when you say some selected key words. Can that feature be use to trigger actions.
For example, when I say meeting, can it execute the command /todo #me meeting due today?
You can setup custom triggers for the slackbot, but it won't do what you're looking for because the todo-bot actions don't seem to trigger from another bot.
To setup custom slackbot responses you'd go to Customize Slack, then select the tab option for the Slackbot. From here, if the word in the left column is seen in a channel, slackbot will respond with the text on the right. It can't grab any info like the channel name or user name, just respond with text. This is useful for reminders like the wifi password or some brief custom help message.
Todo-bot now has webhooks. I haven't used it myself, but I've linked to the introduction page below. You can't do this entirely from within slack; An outside piece of software or server would need to be setup to monitor slack for triggers and create custom prefabricated todo's.
https://help.todobot.io/hc/en-us/articles/115010096748-Incoming-Webhooks

Resources