Git Product home page Git Product logo

vue-slackhook's Introduction

This package is no longer maintained. Please be careful using this package, it will expose your webhook url to the client so only use it if you are sure your application is not user facing.

Vue-Slackhook

A Vue component to implement a feedback form for users to give feedback on your application, with integration of a Slackwebhook.

About the project

The current version of this project is 0.0.8. I intend to contribute a lot more to this package with new features and more possibilities. For now I have only tested this as a component within a Vue-loader project and a Laravel Project.

Installation

  • Make sure to have a slack workspace available and create a new channel to recieve the feedback data

  • Login to your slack account/workspace and create a new app over here

  • Create a new incoming webhook here and retrieve the webhook URL.

After these steps run the following command

# install dependencies
npm install vue-slackhook axios --save-dev

Usage

<script>
import { Feedback } from 'vue-slackhook'
import axios from 'axios'

export default {
    
    ...

    components: {
        Feedback
    }

    ...

};
</script>
<Template>

    <Feedback webhookUrl="WEBHOOK URL HERE" />

</Template>

Options/Props

<script>

    ...

    props: {

        //Use this prop to integrate your slack channel
        webhookUrl: {
            type: String,
            default: 'No webhook url is applied'
        },

        //Submit button text
        submitButtonText: {
            type: String,
            default: 'Send'
        },

        //Trigger button text
        buttonText: {
            type: String,
            default: '?'
        },

        //Font-awesome icon as button text (make sure to include font awesome)
        buttonFa: {
            type: Boolean,
            default: false
        },

        //Font awesome icon name (for instance user == fa fa-user)
        icon: {
            type: String,
            default: 'user'
        },
        
        //Set this prop to true to activate a pre-defined theme
        theme: {
            type: Boolean,
            default: false
        },
        
        //Fill out the application name (Used for slack pre-message)
        applicationName: {
            type: String,
            default: ''
        },
        
        //Label for the name field
        labelName: {
            type: String,
            default: 'Name'
        },
        
        //Label for the subject field
        labelSubject: {
            type: String,
            default: 'Subject'
        },
        
        //Label for the description field
        labelDescription: {
            type: String,
            default: 'Description'
        }

    }

    ...

</script>

<template>

    //This wil render a trigger button with the 'fa fa-question' icon and a submit button that says 'Send'
    <Feedback  submitButtonText="Send" buttonText="Feedback here" :buttonFA="true"  icon="question" />

</template>    

Using Laravel

In your app.js

Vue.component('feedback', require('vue-slackhook'));

camelCase vs kebab-case

It is possible that your props are not working. Instead of writing your props camelCase you must write them kebab-case. You can read more here.

Example: <Feedback button-text="Feedback here" :button-fa=true icon="question" submit-button-text="Post!" />

Props for Laravel

There are props available specific for the Laravel framework.

        //If true props page and user will be included for sending to slack
        laravel: {
            type: Boolean,
            default: false
        },
        
        //Use this prop with the currentRouteName() function to send the current route
        page: {
            type: String,
            default: 'No page found'
        },
        
        //Use this prop with the Auth::user()->username function to send the logged in user
        user: {
            type: String,
            default: 'No user found'
        }

Styling

Besides the pre-defined theme this component has CSS classes on different elements to style the component. All CSS classes will be available soon.

Contribution

If you have any questions, please feel free to contact me at twitter or create a new issue. Feel free to use this project yourself.

vue-slackhook's People

Contributors

glenngijsberts avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.