Amazon AlexaAWS

Use “AlexaWP” plugin to integrates with Amazon Alexa and WordPress (Try Flash Briefing)

“AlexaWP” plugin is a WordPress plugin that integrates with Amazon Alexa to create and enable the […]

広告ここから
広告ここまで

“AlexaWP” plugin is a WordPress plugin that integrates with Amazon Alexa to create and enable the creation of Alexa skills.

Prepare

You need to install Fieldmanager plugin.

$ /PATH/TO/WORDPRESS/wp-content/plugins
$ git clone git@github.com:alleyinteractive/wordpress-fieldmanager.git
$ wp plugin get wordpress-fieldmanager --format=json
{
  "name": "wordpress-fieldmanager",
  "title": "Fieldmanager",
  "author": "Austin Smith, Matthew Boynes",
  "version": "1.1.0-beta.1",
  "description": "Add fields to content types programatically.",
  "status": "inactive"
}
$ wp plugin activate wordpress-fieldmanager
Success: Plugin 'wordpress-fieldmanager' activated.

Installation

$ git clone git@github.com:tomharrigan/AlexaWP.git
$ wp plugin get AlexaWP --format=json
{
  "name": "AlexaWP",
  "title": "Alexa WP",
  "author": "TomHarrigan",
  "version": "0.1",
  "description": "Create Alexa skills using your WordPress site",
  "status": "inactive"
}

Activate plugin

You need activate AlexaWP plugin and flush rewrite rules.

$ wp plugin activate AlexaWP
$ wp rewrite flush

After activate the plugin, you can call alexawp/v1 api

$ curl https://example.com/wp-json/alexawp/v1 | jq .
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   905    0   905    0     0   1568      0 --:--:-- --:--:-- --:--:--  1568
{
  "namespace": "alexawp/v1",
  "routes": {
    "/alexawp/v1": {
      "namespace": "alexawp/v1",
      "methods": [
        "GET"
      ],
      "endpoints": [
        {
          "methods": [
            "GET"
          ],
          "args": {
            "namespace": {
              "required": false,
              "default": "alexawp/v1"
            },
            "context": {
              "required": false,
              "default": "view"
            }
          }
        }
      ],
      "_links": {
        "self": "https://example.com/wp-json/alexawp/v1"
      }
    },
    "/alexawp/v1/skill/briefing": {
      "namespace": "alexawp/v1",
      "methods": [
        "GET"
      ],
      "endpoints": [
        {
          "methods": [
            "GET"
          ],
          "args": []
        }
      ],
      "_links": {
        "self": "https://example.com/wp-json/alexawp/v1/skill/briefing"
      }
    },
    "/alexawp/v1/skill/news": {
      "namespace": "alexawp/v1",
      "methods": [
        "POST"
      ],
      "endpoints": [
        {
          "methods": [
            "POST"
          ],
          "args": []
        }
      ],
      "_links": {
        "self": "https://example.com/wp-json/alexawp/v1/skill/news"
      }
    },
    "/alexawp/v1/skill/(?P\\d+)": {
      "namespace": "alexawp/v1",
      "methods": [
        "POST"
      ],
      "endpoints": [
        {
          "methods": [
            "POST"
          ],
          "args": []
        }
      ]
    }
  },
  "_links": {
    "up": [
      {
        "href": "https://example.com/wp-json/"
      }
    ]
  }
}

Create “Flash Briefing feed” content

After setup, you can see “Briefings” post type in your dashboard.

You can create Flash briefing post .

After publsh your post, you can get Flash briefing post from alexawp/v1/skill/briefing.

$ curl https://example.com/wp-json/alexawp/v1/skill/briefing
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   191    0   191    0     0    956      0 --:--:-- --:--:-- --:--:--   955
{
  "uid": "587f3a8760e78",
  "updateDate": "1970-01-01T00:33:37.0Z",
  "titleText": "Example Briefing News",
  "mainText": "This is a example flash briefing news!",
  "redirectionUrl": "https://example.com"
}

Create Alexa Skill

Then, you have to create your own Amazon Alexa Skill.

Access Amazon Developer Console

https://developer.amazon.com/edw/home.html#/skills/list

Choose “Alexa Skills Kit”.

Setting up Alexa Skill

Set “Skill Information”

Confirm “Flash Briefing Feed Configuration”

Configure feed setting.

After setting up “Flash Briefing Feed Configuration”, you can use your Amazon Alexa device like “Amazon Echo”, “Amazon Echo dots”, and more.

Install into your Alexa Device

Go to https://alexa.amazon.com/spa/index.html.

Your created skill can see in [Skills] tab.

Click your skills name, you can check your skill information and enable your skill in your device.

Your skill information

Finally, you talk to your Alexa device like “Alexa, what’s my Flash Briefing?”

Enjoy !

ブックマークや限定記事(予定)など

WP Kyotoサポーター募集中

WordPressやフロントエンドアプリのホスティング、Algolia・AWSなどのサービス利用料を支援する「WP Kyotoサポーター」を募集しています。
月額または年額の有料プランを契約すると、ブックマーク機能などのサポーター限定機能がご利用いただけます。

14日間のトライアルも用意しておりますので、「このサイトよく見るな」という方はぜひご検討ください。

広告ここから
広告ここまで

Related Category posts