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
Related
I've created a telegram bot. He has one mission to inform in group about new orders. When the customer create new order, telegram bot sends message with information that new order was created.
I use this api: ( Chat id and token are provided as an example)
https://api.telegram.org/bot449123456:AAHSAnSGDm8PW2Z-1ZiwdVDmgv7sM3NMTxg/sendMessage?chat_id=311911234&text=Hi+Everyone
All works fine, but how can I send not a simple text( with + as a whitespace) but a big text with information about order, and order cart?
I think I should use another method instead of simple call api...
Now, I am using nest js for backend, and yes, I know about telegraf and other npm packages, but because I use this bot only for send information from site, could I avoid additional packages and create a simple api call with big text? Thanks in advance.
Thanks for you suggestion #micael-levi. I have found a method
To put my text into variable
To encode this variable with method encodeURIComponent
To Specify in API params that it is a HTML and it should be parsed as a HTML (parse_mode=HTML)
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.
I was hoping to get guidance into how I may use Dialog Flow to shorten the process of getting information from an action.
For example, I would like to provide the following command:
"Ok Google, Ask my test app what is the capital city of the US."
However, I currently need to say:
"Ok, Google, open my test app"
I would then need to wait for a response before providing the name of the country that I need the capital city for.
I'm finding the guidance from the Google documentation difficult to follow.
Do I need to create an implicit invocation in order to give the parameter with the launch command?
Yes, if you want to trigger intents from the launch commands you have to add those intents as a deep link / implicit invocation, to do this the only thing you have to do is create an intent which can handle the parameter and then add it to the implicit intents under the actions on google integration section in Dialogflow.
You don't have to create any intent specially for implicit invocation, you can just use the ones you have already created for normal conversations.
I've written an guide to implicit invocations / deep links for Google Assistant if you need more help or infomation. Here is a video with the end result
In my NodeJS Dialogflow fulfillment, I want to reference an output context parameter from an intent from 2 requests ago within the session.
The queryResult of the latest request doesn't have that data. And the samples only seem to process WebhookRequest and WebhookResponse (
reference: https://dialogflow.com/docs/reference/api-v2/rest/v2beta1/WebhookResponse )
If I can access https://dialogflow.com/docs/reference/api-v2/rest/v2beta1/projects.agent.sessions.contexts/get I may be able to do it. But I don't quite understand if that implies mixing https://github.com/dialogflow/fulfillment-webhook-nodejs/blob/master/functions/index.js with this Client Library:
https://github.com/googleapis/nodejs-language .
In other words, it's not clear to me what the purpose of https://github.com/googleapis/nodejs-language is. Is nodejs-language intended to substitute actions-on-google fulfillments (in the format of https://github.com/dialogflow/fulfillment-webhook-nodejs/blob/master/functions/index.js ) ?
There is a lot going on here, and it isn't quite clear why you think things fit together the way you do.
The nodejs-language library is used to access Google's Natural Language API that runs as part of the Google Cloud Machine Learning API family. This is a completely separate product from the Google Assistant, Actions on Google, and Dialogflow systems. It is meant as an API for people who are looking for a pre-trained AI that can do things like sentiment and syntax analysis. It is not meant as a substitute for any part of the AoG or Dialogflow platform.
As long as the context set two requests ago was set with a lifetime more than 2, and wasn't cleared in between, then it still should be valid and sent to your fulfillment webhook. Since it sounds like you're using Dialogflow V2, you should be able to get all the currently valid contexts as part of the request that is sent to your fulfillment webhook by looking at the queryResult.contexts object in the request body.
If you're using the fulfillment-webhook-nodejs library that you referenced in your post, this should be available to you in the inputContexts variable.
We are having two teams building two bots for our Facebook fanpage. One is for customer service and the other one is for a quiz campaign. Can we have the two bots on the same fanpage? Will there be any conflicts such as the custom menu?
The short answer is YES!
However unless managed correctly there will be conflict.
I know it is possible to use one chatbot built on ManyChat and another on Flowxo.
I need to ensure that I LIMIT the "keywords" in ManyChat so that ManyChat does not respond and allows FLOWXO to respond.
In my situation, I am using the Pro version of MC to get users subscribed and to further broadcast to them or subscribe them to a sequence. I pass over the conversation to Flowxo for integrations to third party software and for the basic conversational aspect of the chatbot.
Passing the conversation over from one chatbot to the other takes some manipulation of the use of keywords and Flowxo's "unrecognised phrase" flow.
I will post the link to a blog post when I get around to writing about how I did it.
Another issue as you pointed out is the Greeting and Welcome text. I have not figured out a way to control this and as it turns out with my chatbot, users always appear to enter into the chatbot via ManyChat which fortunately for me is exactly what I need.