Git Product home page Git Product logo

botkit-ciscospark-samples's Introduction

BotKit samples for Cisco Spark

Assuming your bot is accessible from the internet or you exposed it via a tunnelling tool such as ngrok, you can run any sample in a snatch:

From a bash shell, type:

> git clone https://github.com/CiscoDevNet/botkit-ciscospark-samples
> cd botkit-ciscospark-samples
> npm install
> SPARK_TOKEN=0123456789abcdef PUBLIC_URL=https://abcdef.ngrok.io SECRET="not that secret" node helloworld.js

From a windows shell, type:

> git clone https://github.com/CiscoDevNet/botkit-ciscospark-samples
> cd botkit-ciscospark-samples
> npm install
> set SPARK_TOKEN="0123456789abcdef"
> set PUBLIC_URL="https://abcdef.ngrok.io"
> set SECRET="not that secret"
> node helloworld.js

where:

  • SPARK_TOKEN is the API access token of your Cisco Spark bot
  • PUBLIC_URL is the root URL at which Cisco Spark can reach your bot
  • SECRET is the secret that Cisco Spark uses to sign the JSON webhooks events posted to your bot
  • ngrok helps you expose the bot running on your laptop to the internet, type: ngrok http 8080 to launch

New to BotKit? Read the BotKit for CiscoSpark Guide

New to CiscoSpark? Read the Starter Guide we use at hackathon. Or go straight to Spark4Devs, signin and click My apps to create a bot account.

Hello World

Simplest bot you can code: simply echoes a message with a mention of the Cisco Spark user that mentionned him.

hello-bot-direct

And don't forget to mention him in group rooms.

hello-bot-group

Note that the bot will respond to anyone mentioning him, then no reason why he could not chat with other bots. Below, the Hello bot (impersonnated via the Playground bot token) helling the CiscoDevNet bot.

hello-bot-playing

Emoji

This bot turns emoji tags to unicode characters and posts back the 'emojified' phrase

The bot leverages the experimental websocket library for CiscoSpark, so that you don't need to register a Webhook onto CiscoSpark, and expose your bot in the internet.

From a bash shell, type:

> npm install
> SPARK_TOKEN=0123456789abcdef node emoji.js

From a Windows shell, type:

> npm install
> set SPARK_TOKEN="0123456789abcdef"
> node emoji.js

emoji

CiscoDevNet events

This bot illustrates how you can create conversations, and calls an external API hosted on Heroku that lists current and upcoming events at DevNet.

devnet-botkit

botkit-ciscospark-samples's People

Contributors

objectisadvantag 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.