Code Monkey home page Code Monkey logo

watsonwork-sender's Introduction

watsonwork-sender

Build Status

A Node.js sample app that sends a message to a space in [IBM Watson Workspace] (https://workspace.ibm.com).

The Watson Work platform provides spaces for people to exchange messages in conversations. This sample app shows how to retrieve information about a space, then send a message to the conversation in that space. It also demonstrates how to authenticate an application and obtain the OAuth token needed to make Watson Work API calls.

Try it out

To try the sample app do the following:

Registering the app

In your Web browser, go to [Watson Work Services - Apps] (https://workspace.ibm.com/developer/apps), add a new app named Sender and write down its app id and app secret.

Building the app

Install Node.js 6+.

In a terminal window, do the following:

# For more verbose output
export DEBUG=watsonwork-*

# Get the code
git clone https://github.com/watsonwork/watsonwork-sender

# Build the app
cd watsonwork-sender
npm run build

Adding the app to a space

Leave the terminal window open as you'll need it again soon.

In your Web browser, go to Watson Workspace, create a space named Examples, then open the Apps tab for that space and add the Sender app to it.

Sending a message using the app

You're now ready to use the sample app to send a message!

Back in the terminal window, do the following:

# Configure the app id and app secret
export SENDER_APP_ID=<the Sender app id>
export SENDER_APP_SECRET=<the Sender app secret>

npm run sender "Examples" "Hello *there*"

The Sender app will send "Hello there" to the conversation in the Examples space. You should now see a new message in that space.

Project layout

The sample project source tree is organized as follows:

README.md     - this README
package.json  - Node.js package definition

src/          - Javascript sources

  app.js      - main app script

  test/       - unit tests

What API does the app use?

The app uses the [Watson Work OAuth API] (https://workspace.ibm.com/developer/docs) to authenticate and get an OAuth token. It then uses the [Watson Work GraphQL API] (https://workspace.ibm.com/developer/docs) to retrieve a list of spaces. Finally, it uses the [Watson Work Spaces API] (https://workspace.ibm.com/developer/docs) to send a message to the conversation in the selected space.

How can I contribute?

Pull requests welcome!

watsonwork-sender's People

Contributors

jsdelfino avatar

Watchers

James Cloos avatar William Holmes 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.