Meghal Raval

Meghal Raval

1572407655

A beginner’s guide to build a basic Slackbot

How to build a basic slackbot: a beginner’s guide

Let’s try and automate something [in python]

Slackbots: Why use them?

Before we get into the tutorial part of this post, let’s take a look at why this can be a worthy project and tool.

Slack is an increasingly popular tool for team-wide communication. It’s grown to include plugins for other widely used project management tools, like JIRA, Google Drive, and the likes. Any slack user knows — the more you can do from within the conversation, the better.

Common uses for a slackbot range from a simple notifier for when a task is complete (like a test build, or when your lunch is ready) to interactive, button-based bots that execute commands at the user’s will. You can build polling mechanisms, conversational bots, and more.

Setting up a python programming environment

If you’re a windows user and you haven’t used python before, you’ll need to install it. Linux/Mac users: Unix comes with python!

Once installed, fire up your terminal and type python or python3 (if you have multiple installations) to make sure it works and is there.

Also check to see you have a good text editor for code: sublime and atom are great choices.

Optional: It might also be useful to work in a virtual environment — it’s good practice for when you have a lot of dependencies.

pip install virtualenvvirtualenv tutorialsource tutorial/bin/activate

You should also fork the tutorial GitHub repo and clone to your local machine, as we’ll be using that code as a framework for this tutorial.

To do this, go to the repo and click Fork on the top right. The forked repo should be yourusername/slackbot-tutorial. Hit the green Clone or download button on the right under the stats bar, and copy the url. Return to the terminal to clone the repository:

cd Desktop/git clone https://github.com/yourusername/slackbot-tutorial.gitcd slackbot-tutorial/sublime . (or open your text editor and open this directory)

Slack Apps

There are two ways to go about creating your slackbot: standalone bots, or Slack apps. Apps allow a wider range of functionality going forward, and is Slack’s recommended route for creating a bot user.

Go to https://api.slack.com/apps and hit Create New App on the top right. Give it a name and pick a workspace where you can create a channel to test your bot in. You can always reconfigure your bot for another workspace later, or even post it to the Slack App Directory.

The first thing you’ll want to do is get the bot token. When you get to the above page, click Bots and create a bot user. The defaults are fine, although you can rename your bot if you wish.

Now, to actually get your tokens, you’ll want to go to OAuth & Permissions on the left sidebar.

Here, you’ll be able to Install the App to the Workspace and generate the necessary tokens. As a rule of thumb, bot tokens start with xoxb-.

You’ll also want the verification token, which is located under Basic Information > App Credentials.

Acting as your Bot

Now you have the credentials necessary to make API calls and act as your bot. To test this out, fire up a terminal and run this (with the correct token and channel name):

curl -X POST \     -H 'Authorization: Bearer xoxb-your-token' \     -H 'Content-type: application/json;charset=utf-8' \    --data '{"channel":"#test","text":"Hello, Slack!"}' \https://slack.com/api/chat.postMessage

If you go to that channel in your slack workspace, you should now see a message from your bot! You just made an HTTP POST request — asked a server to post a message somewhere.

Programming the Bot

We want to do the above programatically. There are a few different ways you can set up a slackbot. I’ll cover the following:

  • Triggered periodically (on a schedule) to say something
  • /slash commands

The second requires a server running, while the first does not.

Scheduled Messages

Let’s say you want to periodically send a message somewhere — maybe every Monday morning. Go to the text editor where you opened up slackbot-tutorial.

You should see a file scheduled.py. Take a look: sendMessage is a function that fires off the API call to slack and posts a message. At the bottom, you’ll see the main method: what executes when you run the script. Here, you’ll see a few things to note:

  • SLACK_BOT_TOKEN isn’t stored in the file. Instead, the script gets it from the OS — how? Run export SLACK_BOT_TOKEN="xoxb-your-token" in your terminal to set this variable.
  • a scheduler is used here, and there’s an infinite loop that checks for events on the scheduler. By default here, I’ve scheduled the sendMessage function to be called every minute.

To test this out, go back to the terminal where you’re in the slackbot-tutorial directory and run

export SLACK_BOT_TOKEN="xoxb-your-token"python scheduled.py

You should see the log messages print. Let it run for a couple minutes and watch the messages show up on Slack! If you don’t have a test channel named #test, change that in the script.

This is, of course, a super basic implementation of a scheduled message sender — you can actually do this just with slackbot /remind #test “Hello, Slack!” every Monday at 9am.

The true power here is that you can substitute in any function for sendMessage, leveraging the power of interfacing with external services through APIs, doing math, etc and then constructing a message to post.

Slash Commands

This one requires a little more setup — go back to your app settings > Slash Commands. Create a new slash command: for example, /test. For the request URL, you’ll need to either deploy this web server (I use Heroku), or run a local nginx instance to test it. The latter will run it locally. Get nginx set up here.

In the starter code repo, look for slashCommand.py to start understanding this method. To start the server, run python server.py. The Request URL to put in Slack will be given by your nginx instance and the @app.route in your code. You should be able to test the slash commands in your Slack workspace.

Moving Forward

Now you have a very basic slackbot that either operates on a command or runs every so often. Be creative with how you use it! Think about what else you can link this skeleton to to make it more useful.

Other ways your bot might respond

  1. Actions/responses could be triggered by mentions or certain phrases. This requires running a server and listening the messages somewhere.
  2. You bot could be conversational, and might contribute to threads. Check out some NLP to get started on having intelligible conversation! Word2Vec + TensorFlow or Keras might be a place to start. DialogFlow is also great.
  3. Link it up with some other APIs. Maybe you want to be able to interact with a Google Sheet and run some calculations. You might want to send other users a message based on some actions. Integrate buttons. Perhaps you want to trigger messages based on something else.

#chat-bot #slack #python

What is GEEK

Buddha Community

A beginner’s guide to build a basic Slackbot
Abigail betty

Abigail betty

1624226400

What is Bitcoin Cash? - A Beginner’s Guide

Bitcoin Cash was created as a result of a hard fork in the Bitcoin network. The Bitcoin Cash network supports a larger block size than Bitcoin (currently 32mb as opposed to Bitcoin’s 1mb).

Later on, Bitcoin Cash forked into Bitcoin SV due to differences in how to carry on its developments.

That’s Bitcoin Cash in a nutshell. If you want a more detailed review watch the complete video. Here’s what I’ll cover:

0:50 - Bitcoin forks
2:06 - Bitcoin’s block size debate
3:35 - Big blocks camp
4:26 - Small blocks camp
5:16 - Small blocks vs. big blocks arguments
7:05 - How decisions are made in the Bitcoin network
10:14 - Block size debate resolution
11:06 - Bitcoin cash intro
11:28 - BTC vs. BCH
12:13 - Bitcoin Cash (ABC) vs. Bitcoin SV
13:09 - Conclusion
📺 The video in this post was made by 99Bitcoins
The origin of the article: https://www.youtube.com/watch?v=ONhbb4YVRLM
🔺 DISCLAIMER: The article is for information sharing. The content of this video is solely the opinions of the speaker who is not a licensed financial advisor or registered investment advisor. Not investment advice or legal advice.
Cryptocurrency trading is VERY risky. Make sure you understand these risks and that you are responsible for what you do with your money
🔥 If you’re a beginner. I believe the article below will be useful to you ☞ What You Should Know Before Investing in Cryptocurrency - For Beginner
⭐ ⭐ ⭐The project is of interest to the community. Join to Get free ‘GEEK coin’ (GEEKCASH coin)!
☞ **-----CLICK HERE-----**⭐ ⭐ ⭐
Thanks for visiting and watching! Please don’t forget to leave a like, comment and share!

#bitcoin #blockchain #bitcoin cash #what is bitcoin cash? - a beginner’s guide #what is bitcoin cash #a beginner’s guide

A Beginner’s Guide to Setting Up a Web Application with Typescript and Express

Web applications are types of software applications that run on remote servers (source). Examples of web applications can range from word processors, to file scanners, video editing tools, shopping carts, and more. Web applications can be great additions to any website; they can even function as websites themselves (Facebook, Gmail, and Udacity’s classroom are all examples of popular web applications), so understanding how to set up and implement a web application is a fantastic skill to have.

For this guide, I am assuming that you already have a basic knowledge of npmnode and whatExpress Requests and Responses are (or that you at least know what they are used for in their basic sense). Also, I assume that you know what the npm install and mkdir commands do. You have to know basic Typescript to implement — or at least know basic JavaScript to read and understand — the code below. Finally, this is the base for the backend of a web application. You still need to create a frontend application using a framework like Angular or an HTML/CSS file to make requests and display responses.

Before you start, it’s important that you create a folder in your favorite place on your computer. This can be anywhere as long as you have a sense of how you are going to find it later when you come up with an awesome project to start developing.

The Process:

Image for post

#web-development #backend #software-development #beginners-guide #beginner

Tia  Gottlieb

Tia Gottlieb

1596336480

Beginners Guide to Machine Learning on GCP

Introduction to Machine Learning

  • Machine Learning is a way to use some set of algorithms to derive predictive analytics from data. It is different than Business Intelligence and Data Analytics in a sense that In BI and Data analytics Businesses make decision based on historical data, but In case of Machine Learning , Businesses predict the future based on the historical data. Example, It’s a difference between what happened to the business vs what will happen to the business.Its like making BI much smarter and scalable so that it can predict future rather than just showing the state of the business.
  • **ML is based on Standard algorithms which are used to create use case specific model based on the data **. For example we can build the model to predict delivery time of the food, or we can build the model to predict the Delinquency rate in Finance business , but to build these model algorithm might be similar but the training would be different.Model training requires tones of examples (data).
  • Basically you train your standard algorithm with your Input data. So algorithms are always same but trained models are different based on use cases. Your trained model will be as good as your data.

ML, AI , Deep learning ? What is the difference?

Image for post

ML is type of AI

AI is a discipline , Machine Learning is tool set to achieve AI. DL is type of ML when data is unstructured like image, speech , video etc.

Barrier to Entry Has Fallen

AI & ML was daunting and with high barrier to entry until cloud become more robust and natural AI platform. Entry barrier to AI & ML has fallen significantly due to

  • Increasing availability in data (big data).
  • Increase in sophistication in algorithm.
  • And availability of hardware and software due to cloud computing.

GCP Machine Learning Spectrum

Image for post

  • For Data scientist and ML experts , TensorFlow on AI platform is more natural choice since they will build their own custom ML models.
  • But for the users who are not experts will potentially use Cloud AutoML or Pre-trained ready to go model.
  • In case of AutoML we can trained our custom model with Google taking care of much of the operational tasks.
  • Pre-trained models are the one which are already trained with tones of data and ready to be used by users to predict on their test data.

Prebuilt ML Models (No ML Expertise Needed)

  • As discuss earlier , GCP has lot of Prebuilt models that are ready to use to solve common ML task . Such as image classification, Sentiment analysis.
  • Most of the businesses are having many unstructured data sources such as e-mail, logs, web pages, ppt, documents, chat, comments etc.( 90% or more as per various studies)
  • Now to process these unstructured data in the form of text, we should use Cloud Natural Language API.
  • Similarly For common ML problems in the form of speech, video, vision we should use respective Prebuilt models.

#ml-guide-on-gcp #ml-for-beginners-on-gcp #beginner-ml-guide-on-gcp #machine-learning #machine-learning-gcp #deep learning

Micheal  Block

Micheal Block

1600671600

Start-off with Streamlit(Beginner’s Approach)

Streamlit is an open-source app framework** that **isthe easiest way for data scientists and machine learning engineers to create beautiful, performant apps in only a few hours!

By the end of this blog, you are going to be comfortable with using Streamlit to build a basic streamlit web-application.

#beginner #tutorial #beginners-guide #web-app-development #streamlit

The Best Way to Build a Chatbot in 2021

A useful tool several businesses implement for answering questions that potential customers may have is a chatbot. Many programming languages give web designers several ways on how to make a chatbot for their websites. They are capable of answering basic questions for visitors and offer innovation for businesses.

With the help of programming languages, it is possible to create a chatbot from the ground up to satisfy someone’s needs.

Plan Out the Chatbot’s Purpose

Before building a chatbot, it is ideal for web designers to determine how it will function on a website. Several chatbot duties center around fulfilling customers’ needs and questions or compiling and optimizing data via transactions.

Some benefits of implementing chatbots include:

  • Generating leads for marketing products and services
  • Improve work capacity when employees cannot answer questions or during non-business hours
  • Reducing errors while providing accurate information to customers or visitors
  • Meeting customer demands through instant communication
  • Alerting customers about their online transactions

Some programmers may choose to design a chatbox to function through predefined answers based on the questions customers may input or function by adapting and learning via human input.

#chatbots #latest news #the best way to build a chatbot in 2021 #build #build a chatbot #best way to build a chatbot