GithubHelp home page GithubHelp logo

webtask-editor-templates's Introduction

Webtask Editor Templates

Here you will find the entire list of templates that you can use from Webtask Editor.

Templates

Basically you have two views of templates:

  • Templates list

  • Template details

How to create a template

If you have a webtask to share, you can create a Pull Request and add your template. The team will review it and once it is aproved the template will be available through Webtask Editor.

Fields

name

The name of the template. It will appear on the templates section.

type

This is the type of the example. It can be sample or webhook. Currently not in use.

description

The description of the template it will appear on the list of templates.

author

Indicates who writes the template.

  • name: The name of the author
  • link: A link to GitHub or Twitter
author: 
  name: johndoe
  link: https://github.com/johndoe

sampleRequest

Sample request gives you the posibility to have a sample request by default for testing the webtask.

  • method: The HTTP method. Example: GET, POST, etc.
  • type: The type of the request. It can be: json, xml or text.
  • mode: The mode of the runner. It can be: body, parameters or headers.
  • data: The default data for the request.
sampleRequest: 
  method: 'POST'
  type: 'json'
  mode: 'body'
  data: |
    {
      "token":"REPLACE_WITH_SLACK_TOKEN",
      "team_id":"T0001",
      "team_domain":"example",
      "channel_id":"C2147483705",
      "channel_name":"test",
      "timestamp":"1355517523.000005",
      "user_id":"U2147483697",
      "user_name":"jdoe",
      "text":"googlebot: What is the air-speed?",
      "trigger_word": "googlebot:"
    }

settings

  • parse: Indicates if the body should be parsed.
  • merge: Indicates if the body should be merged.
settings:
  parse: true
  merge: true

secrets

This is the list of secrets that your template requires for working, basically a key/value pair.

secrets: 
  WEBHOOK_SECRET: 'REPLACE_WITH_SLACK_TOKEN'

note

Here you can put some instructions about how to use the template or explain what it does. A note, contains the following fields:

  • title: The title of the note. It will appear on the details section
  • content: The content of the note. It supports markdown.
note:
  title: Description
  content: |
    The `context` argument behaves the same way as in the two simpler programming models. The body of the request will be unconsumed unless the `pb` claim of the [webtask token](https://webtask.io/docs/token) is set to 1. Note that this programming model does not have a concept of a callback. Ending the HTTP response indicates completion.

code

The actual code for the webtask. It supports js or es6.

code:
  js: |
    module.exports = function (context, req, res) {
      res.writeHead(200, { 'Content-Type': 'text/html '});
      res.end('<h1>Hello, world!</h1>');
    }

  es6: |
    'use latest';

    module.exports = (context, req, res) => {
      res.writeHead(200, { 'Content-Type': 'text/html '});
      res.end('<h1>Hello, world!</h1>');
    }

License

This project is licensed under the MIT license. See the LICENSE file for more info.

webtask-editor-templates's People

Contributors

claudiopetrini avatar fyockm avatar glennblock avatar jcenturion avatar lobo avatar ludohenin avatar mauricioschneider avatar notmyself avatar woloski avatar yakirp 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.