fpga中的slack
by Nicolas Grenié
尼古拉斯·格雷尼(NicolasGrenié)
Developer Advocates or Evangelists are often asked how they measure success.
开发者倡导者或传福音者经常被问到如何衡量成功。
One could argue that GitHub ⭐️’s on repositories are great. And Ash Hathaway shares her thoughts here.
有人可能会说GitHub⭐️在存储库上很棒。 Ash Ashhaway 在这里分享了她的想法。
Others could say that Stack Overflow questions give a good sense of an API popularity. I would agree with this statement.
其他人可能会说Stack Overflow问题很好地说明了API的流行性。 我同意这一说法。
If you don’t have a forum for your product, developers may end up asking questions directly on Stack Overflow.
如果您没有产品论坛,那么开发人员可能最终会直接在Stack Overflow上提问。
I would not encourage companies to redirect all their support questions there or pushing for their brand tags, this is just bad. You are hijacking a community for your own needs instead of contributing to it.
我不鼓励公司将所有支持问题重定向到那里,也不要推销其品牌标签,这很糟糕。 您是在为自己的需要劫持社区,而不是为社区做贡献。
What happens when someone is posting a question there?How do you get notified?How can you react quickly?
当有人在那发布问题时会发生什么? 您如何得到通知? 您如何Swift做出React?
In my experience, you can only receive notifications when there are new questions on a particular tag. This might not cover all the questions posted about your API.
以我的经验,只有在特定标签上有新问题时,您才能收到通知。 这可能不会涵盖有关您的API的所有问题。
You can also use tools like Mention. It covers more than Stack Overflow, but it’s not instantaneous.
您还可以使用诸如Mention之类的工具。 它涵盖的内容不止堆栈溢出,而且不是瞬时的。
To be more reactive, I hacked together something for our team at 3scale a long time ago. I recently rewrote it using serverless technologies. It monitors questions about 3scale and posts them on our #support Slack channel. The support team can jump on it and answer quickly.
为了更加被动,我很久以前就为3scale的团队提供了帮助 。 我最近使用无服务器技术重写了它。 它监视有关3scale的问题,并将其发布在我们的#support Slack频道上。 支持团队可以跳下来并Swift回答。
I want to share this project, so you too can monitor Stack Overflow directly in Slack.
我想分享这个项目,所以您也可以直接在Slack中监视Stack Overflow。
To fit in 2017 trend, we will only use serverless technologies, which will make this tool free to use:- AWS Lambda to host the logic of our app- FaunaDB to store databases- Serverless Framework to simplify deployments- Slack to be notified when a new question is asked
为了适应2017年的趋势,我们将仅使用无服务器技术,这将使该工具免费使用: -AWS Lambda托管我们的应用程序逻辑-FaunaDB存储数据库-Serverless Framework简化部署-在出现以下情况时通知Slack提出新问题
Stack Exchange API has an endpoint to search for questions. You can look for a term in tags, in the title, in the body of the question or all at the same time. In the example, we will search in all attributes.
Stack Exchange API有一个端点来搜索问题。 您可以同时在标签,标题,问题正文或全部中查找术语。 在示例中,我们将搜索所有属性。
You should create a key to access Stack Exchange API here.
您应该在此处创建一个密钥来访问Stack Exchange API。
Our function will regularly call this endpoint to check if there are new questions posted. We will use the Schedule Events feature offered natively by Lambda, it’s a similar behavior as a cron job.
我们的函数将定期调用此终结点,以检查是否发布了新问题。 我们将使用Lambda本身提供的Schedule Events功能,这与cron作业的行为类似。
We will store the questions in a database to keep track of the ones we already sent to Slack and avoid duplicates.
我们会将问题存储在数据库中,以跟踪已经发送给Slack的问题,并避免重复。
If a Stack Overflow question is not in our database, we add it to the database and send details to Slack.
如果堆栈溢出问题不在我们的数据库中,则将其添加到数据库中并将详细信息发送到Slack。
I discovered FaunaDB a few months ago at Gluecon. They present themselves as the first serverless database engine. Everything is hosted on their end. FaunaDB is a globally distributed database that doesn’t require any provisioning. Capacity is metered and available on demand, so you only pay for what you use.
我发现FaunaDB在几个月前Gluecon 。 他们将自己展示为第一个无服务器数据库引擎。 一切都托管在他们的尽头。 FaunaDB是不需要任何配置的全球分布式数据库。 容量是按需计费的,可按需提供,因此您只需要为使用量付费。
If you are familiar with Firebase, you will recognize a similar data structure and routes to access resources. But it comes with more features, which makes it easier for example to query the database.
如果您熟悉Firebase ,您将认识到类似的数据结构和访问资源的路由。 但是它具有更多功能,例如,更易于查询数据库。
For this app, you will need a database, with a questions class. We will also add an index questions_by_id on terms data and question_id. This will let us query the questions class by the Stack Overflow id.
对于此应用程序,您将需要一个带有问题类的数据库。 我们也将在条件数据和question_id添加索引questions_by_id。 这将使我们通过Stack Overflow ID查询问题类。
If you are concerned about your database usage, you can add TTL to the questions class. This will automatically delete instances older than the TTL value.
如果您担心数据库的使用情况,可以将TTL添加到问题类。 这将自动删除早于TTL值的实例。
Finally, you will need to create a server key for the questions class. This key will be used to authenticate our function to FaunaDB servers.
最后,您将需要为问题类创建服务器密钥。 该密钥将用于向FaunaDB服务器验证我们的功能。
To post to Slack, we would just need a simple incoming web hook. Create one here.
要发布到Slack,我们只需要一个简单的传入Web钩子即可。 在此处创建一个。
Make sure you have installed Serverless framework and configured the AWS CLI tool.
You can now clone this project locally.
您现在可以在本地克隆此项目。
git clone git@github.com:picsoung/stackOverflowMonitor.gitcd stackOverflowMonitor
In serverless.yml
you will modify the environment variables to your own values.
在serverless.yml
您将环境变量修改为您自己的值。
FAUNADB_SECRET
is the secret we created earlier to access FaunaDBSTACK_EXCHANGE_KEY
is the API key to access Stack Exchange APISLACK_WEBHOOK_URL
is the URL of the Slack incoming webhook you’ve created SLACK_CHANNEL
should be an existing channel name in your Slack team such as #support or #stackoverflowSEARCH_KEYWORD
is the keyword you are interested in monitoring such as Node.js or Angular2
FAUNADB_SECRET
是我们之前创建的用于访问FaunaDB的秘密STACK_EXCHANGE_KEY
是用于访问Stack Exchange API的API密钥SLACK_WEBHOOK_URL
是您创建的Slack传入SLACK_WEBHOOK_URL
的URL SLACK_CHANNEL
应该是Slack团队中现有的频道名称,例如#support或# stackoverflow SEARCH_KEYWORD
是您想要监视的关键字,例如Node.js或Angular2
Once you have changed all the variables to your own values, we can test if everything works. We invoke the function locally with the following command:
将所有变量更改为自己的值后,我们可以测试一切是否正常。 我们使用以下命令在本地调用该函数:
serverless invoke local — function getStackOverflowQuestions
As it’s the first time you are launching the function, it should post a message to your Slack channel. It should look like this:
由于这是您第一次启动该功能,因此应在您的Slack频道中发布一条消息。 它看起来应该像这样:
If you are happy with the result you can now deploy the function with the following command:
如果您对结果满意,现在可以使用以下命令部署该功能:
serverless deploy
By default, the function is called every 20 minutes. You can customize it by changing the schedule property in serverless.yml
file.
默认情况下,该函数每20分钟调用一次。 您可以通过更改serverless.yml
文件中的schedule属性来自定义它。
For now, we are only monitoring one term. You can launch multiple instances of this function to watch more terms or tags on Stack Overflow.
目前,我们仅监视一个术语。 您可以启动此功能的多个实例,以在Stack Overflow上观看更多术语或标签。
If you are interested in near to real-time solution, I encourage you to check Streamdata.io. Their tools turn pulling API into streaming API.
如果您对近乎实时的解决方案感兴趣,建议您检查Streamdata.io 。 他们的工具将拉API转换为流API。
If you want some nice dashboards that show how active your community is on Stack Overflow, I recommend Keen.io. You can send all your Stack Overflow data there. Keen offers a variety of libraries to build beautiful dashboards.
如果您想要一些漂亮的仪表板来显示您的社区在Stack Overflow上的活跃度,我建议Keen.io。 您可以在那里发送所有堆栈溢出数据。 Keen提供了各种库来构建漂亮的仪表板。
We can also add more features in Slack, like buttons or menus. So people can claim a question or get assigned a question to answer.
我们还可以在Slack中添加更多功能,例如按钮或菜单。 因此,人们可以提出问题或分配问题来回答。
This was a small project that led me to discover how to use FaunaDB. Using AWS Lambda it’s way more efficient that the Heroku instance that I had in the past.
这是一个小项目,使我发现了如何使用FaunaDB。 使用AWS Lambda,它比我过去拥有的Heroku实例效率更高。
I hope you’ve found this serverless example useful. The code is open on GitHub so feel free to contribute and add new features.
我希望您发现此无服务器示例很有用。 该代码在GitHub上开放 ,因此随时可以贡献并添加新功能。
If you are working for a company that is selling to developers I am sure you already heard the “Be where the developers are.”
如果您在一家向开发人员销售产品的公司工作,我相信您已经听说过“成为开发人员的地方”。
In the online world you have a good chance to find developers on websites like Hackers News, Stack Overflow, or GitHub. It’s important to measure what people say about your product or technologies on those sites.
在在线世界中,您有很好的机会在Hackers News,Stack Overflow或GitHub等网站上找到开发人员。 衡量人们在这些站点上对您的产品或技术的评价很重要。
This was a small project that led me to discover how to use FaunaDB. Using AWS Lambda is way more efficient than the Heroku instance that I had in the past.
这是一个小项目,使我发现了如何使用FaunaDB。 与过去的Heroku实例相比,使用AWS Lambda效率更高。
I hope you’ve found this serverless example useful. The code is open on GitHub so feel free to contribute and add new features.
我希望您发现此无服务器示例很有用。 该代码在GitHub上开放 ,因此随时可以贡献并添加新功能。
翻译自: https://www.freecodecamp.org/news/monitor-stack-overflow-activity-directly-into-slack-dc778913490f/
fpga中的slack