Skip to content

Example skills and a cli utility written in Go for interacting with Webex Assistant Skills

License

Notifications You must be signed in to change notification settings

darrenparkinson/wxa-skills-go

Repository files navigation

Webex Assistant Skills - Go

Status GitHub tag (latest SemVer) GitHub GoDoc Go Report Card

This repository holds example skills and a cli utility written in Go for interacting with Webex Assistant Skills. For more information on Webex Assistant Skills, please see the official Webex Assistant Skills Overview.

It is intended as an alternative to the official Webex Assistant SDK, as documented in the Webex Assistant Skills Guide, without the need for installing python and the required dependencies. Simply download the binaries from the releases tab to get started.

It is currently a work in progress, so expect things to change as more is learned about this new webex feature.

Quick Start

You should be famililar with the Getting Started documentation. This quickstart assumes you'll be using the simulator to test.

Quick Start Requirements

To get started, you will need:

  • Your tenant enabled for skills;

You will only need the following if you wish to register your skill from the CLI instead of using the Webex Assistant Skills Developer Portal:

You will only need the following if you wish to test your skill using the simulator:

  • Your base64 decoded organisation ID (for the simulator): get your orgId and base64 decode it here taking the last part after ciscospark://us/ORGANIZATION/
  • A token with the assistant scope to run the skill. You can temporarily get this from here until there is proper tooling;

Quick Start Steps

  1. Create a folder and download the binaries from the releases page:
    a. wxa-cli - for generating the keys and the secret, along with registering your skill;
    b. echo-skill-secure - for the test skill;
    c. echo-skill-secure-tester for testing the skill locally;

  2. Generate a public/private key pair:

$ ./wxa-cli generate-keys
  1. Generate a secret:
$ ./wxa-cli generate-secret > secret.txt
  1. (Optional) Set your environment variables or put them in a .env file:
SKILL_PUBLIC_KEY=<YOUR PUBLIC KEY HERE>
SKILL_PRIVATE_KEY=<YOUR PRIVATE KEY HERE>
SKILL_SECRET=<YOUR SECRET HERE>

If you don't set these, by default the skill will look in the current directory for secret.txt, private.pem and public.pem.

  1. Set up a tunnel to your machine using localtunnel or ngrok, e.g:
ngrok http 8080

Use the https endpoint provided by ngrok in the next step.

  1. Create the Skill on the Skills Service using the details obtained earlier:

You can do this on the Webex Assistant Skills Developer Portal as documented in the Webex Assistant Skills Guide Developer Portal Guide or use the wxa-cli command:

$ wxa-cli create-skill --name="Echo" --url="<YOUR_URL_FROM_STEP_5>" --contact="<YOUR_EMAIL>" -secret="$(cat secret.txt)" --public="$(cat public.pem)" --token="<YOUR_PERSONAL_ACCESS_TOKEN>" --developerid="<YOUR_DEVELOPER_ID>"

Replacing values in < > with the relevant details from earlier. Note the use of cat to provide the secret.txt and public.pem content into the command.

  1. Run the skill:
$ ./echo-skill-secure
  1. Test the skill locally:
$ ./echo-skill-secure-tester
  1. Test the skill with the simulator:
  • Visit https://assistant-web.intelligence.webex.com/.
  • Enter the base64 decoded organisation ID and the assistant scoped token.
  • Say or type ask echo hello there

Installation

Binaries

The simplest way is to download the binaries from the releases page.

Go Install

If you have Go installed, you can install using the following commands:

$ go install github.com/darrenparkinson/wxa-skills-go/cmd/wxa-cli@latest
$ go install github.com/darrenparkinson/wxa-skills-go/examples/echo-skill-secure@latest
$ go install github.com/darrenparkinson/wxa-skills-go/examples/echo-skill-secure/cmd/echo-skill-secure-tester@latest

Compiling from source

Again, if you have Go installed, you can also compile from source:

$ git clone https://github.com/darrenparkinson/wxa-skills-go
$ cd wxa-skills-go
$ go mod tidy
$ go build ./cmd/wxa-cli
$ go build ./examples/echo-skill-secure
$ go build ./examples/echo-skill-secure/echo-skill-secure-tester
$ ./wxa-cli --version

About

Example skills and a cli utility written in Go for interacting with Webex Assistant Skills

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages