Click here to load reader

sakura.io handson with twilio 20180123

  • View
    16

  • Download
    0

Embed Size (px)

Text of sakura.io handson with twilio 20180123

  • API Twilio& sakura.ioKDDI

    2018/1/23

    (C) Copyright 1996-2017 SAKURA Internet Inc

    IoT Platform Team

  • 3

  • 4

    1. sakura.ioWeb/Internet of Things(IoT)

    2.

    3. 11Web/

  • sakura.io

    https://secure.sakura.ad.jp/iot/

    Arduino

    https://www.arduino.cc/en/Main/Software

    Arduinobasic-HDC1000-with-LED.ino

    HDC1000 https://github.com/sakuraio/handson-sample/blob/master/arduino/twilio-HDC1000-with-LED.ino

    SHT31 https://github.com/sakuraio/handson-sample/blob/master/arduino/twilio-SHT31-with-LED.ino

    https://secure.sakura.ad.jp/cloud/

    Twilio Functions

    sakura.io Outgoing Webhook https://github.com/sakuraio/handson-sample/blob/master/twilio/outboundcall.js

    https://github.com/sakuraio/handson-sample/blob/master/twilio/ivr.js

    sakura.io Incoming Webhook https://github.com/sakuraio/handson-sample/blob/master/twilio/turn.js

    5

    https://secure.sakura.ad.jp/iot/https://www.arduino.cc/en/Main/Softwarehttps://github.com/sakuraio/handson-sample/blob/master/arduino/twilio-HDC1000-with-LED.inohttps://github.com/sakuraio/handson-sample/blob/master/arduino/twilio-SHT31-with-LED.inohttps://secure.sakura.ad.jp/cloud/https://github.com/sakuraio/handson-sample/blob/master/twilio/outboundcall.jshttps://github.com/sakuraio/handson-sample/blob/master/twilio/ivr.jshttps://github.com/sakuraio/handson-sample/blob/master/twilio/turn.js

  • sakura.io

    https://sakura.io/

    ID https://secure.sakura.ad.jp/signup3/member-register/input.html

    Twilio https://twilio.kddi-web.com/

    sakura.io

    https://sakura.io/developer/

    sakura.io

    https://sakura.io/product/

    SHT31 http://akizukidenshi.com/catalog/g/gK-12125/

    LED http://akizukidenshi.com/catalog/g/gI-06245/

    http://akizukidenshi.com/catalog/g/gC-05159/

    Arduino Uno Rev3 http://akizukidenshi.com/catalog/g/gM-07385/

    AC http://akizukidenshi.com/catalog/g/gM-07772/

    http://akizukidenshi.com/catalog/g/gP-05294/

    6

    https://sakura.io/https://secure.sakura.ad.jp/signup3/member-register/input.htmlhttps://twilio.kddi-web.com/https://sakura.io/developer/https://sakura.io/product/http://akizukidenshi.com/catalog/g/gK-12125/http://akizukidenshi.com/catalog/g/gI-06245/http://akizukidenshi.com/catalog/g/gC-05159/http://akizukidenshi.com/catalog/g/gM-07385/http://akizukidenshi.com/catalog/g/gM-07772/http://akizukidenshi.com/catalog/g/gP-05294/

  • 10

    WebTwilio

    Arduino Uno

    SHT31/HDC1000

    sakura.io

    outboundCall

    IVR

    Turn

    Functions

    outboundwebhook

    inboundwebhook

  • Agenda

    11

    1. sakura.io

    2. Arduino

    3. WebTwilio

    Functionssakura.io Outgoing WebhookoutboundCall

    FunctionsIVR

    Functionssakura.io Incoming Webhookturn

  • 12

    sakura.io

  • 13

    WebTwilio

    Arduino Uno

    SHT31/HDC1000

    sakura.io

    outboundCall

    IVR

    Turn

    Functions

    outboundwebhook

    inboundwebhook

  • sakura.io

    14

    sakura.io https://secure.sakura.ad.jp/iot/ Googlesakura.io https://sakura.io/

    https://secure.sakura.ad.jp/iot/https://sakura.io/

  • 15

    ID

  • ID

    16

    ID https://secure.sakura.ad.jp/signup3/member-register/input.html [email protected]

    Title [XXX00000]

    [email protected]

    (: )

    =============================================================

    ID XXX00000 (: ) [email protected]

    =============================================================

    https://secure.sakura.ad.jp/signup3/member-register/input.html

  • CB

    sakura.io

    18

    sakura.io 1

    A

    1uAAAAAAAAAA

    2uBBBBBBBBBB

    3uCCCCCCCCCC

    Light/Standard/

    ON/OFF

    1WebSocket

    2Outgoing Webhook

    File1/File2/

    3AWS IoT

    1

  • 19

  • 20

  • 21

  • 22

  • 23

    ID

  • 24

    ID/PASS

    ID /

    IDID

  • 25

    ID

  • Incoming Webhook

    26

    Twilio Incoming Webhook Incoming Webhook

  • Incoming Webhook

    27

    Secret

  • Incoming Webhook

    28

    URLURL

  • WebSocket

    29

    WebSocketWebSocket

  • WebSocket

    30

    WebSocket

  • 31

    WebSocketURL

  • WebSocket

    32

    WebSocket

  • 33

  • 34

    WebTwilio

    Arduino Uno

    SHT31/HDC1000

    sakura.io

    outboundCall

    IVR

    Turn

    Functions

    outboundwebhook

    inboundwebhook

  • 35

    sakura.io

    +ArduinoArduino Uno Rev3

    USB2.0

    A-B

    12W 9V-1.3A

    DC

    SB412A

    GL5537-2

    HDC1000 or SHT31

    LED

  • Arduino IDE

    36

    https://www.arduino.cc/en/Main/SoftwareArduino IDE2018/01/23 1.8.5 WindowsWindows Installer MacMac OS X 10.7 Lion or newer

    https://www.arduino.cc/en/Main/Software

  • Arduino IDE

    37

    JUST DOWNLOAD

  • Arduino IDE

    38

    Windows

  • Arduino IDE

    39

    Arduino IDEArduinoPC2 :XXX Arduino/Genuino Uno COMxArduino/Genuino Uno MacCOM /dev/Arduino/Genuino Uno

  • Arduino

    40

    01.Basics Blink BlinkLED

  • 41

    ArduinoPCArduino

  • -HDC1000

    42

    ... hdc1000 HDC1000 by Yuichi Tateno INSTALLED

    HDC1000

  • -SHT31

    43

    ... SHT31 Adafruit SHT31 Library by Adafruit INSTALLED

    SHT31

  • SakuraIO

    44

    ... sakuraio SakuraIO by SAKURA Internet Inc. Ver. INSTALLED

  • FirmwareUpdate.ino

    45

    SakuraIO FirmwareUpdate VersionPC/ Update Failure

    PC/ Update Failure

  • 46

  • HDC1000/SHT31

    47

  • LED

    48

    LED GNDLED

    GND

  • HDC1000/SHT31LED

    49

    LEDArduinoRDY/ADR

    D7SDASCL

    GND

    SCLSDA3.3V

    Digital 7GND

    GND

    GND3.3V

  • -HDC1000

    50HDC1000

    URL Temp

    30 * Sent to sakura.io * https://github.com/sakuraio/handson-sample/blob/master/arduino/twilio-HDC1000-with-LED.ino

    https://github.com/sakuraio/handson-sample/blob/master/arduino/twilio-HDC1000-with-LED.ino

  • -SHT31

    51SHT31

    URL Temp

    30 * Sent to sakura.io * https://github.com/sakuraio/handson-sample/blob/master/arduino/twilio-SHT31-with-LED.ino

    https://github.com/sakuraio/handson-sample/blob/master/arduino/twilio-SHT31-with-LED.ino

  • 52

    sakura.ioWebSocketWebSocket

  • 53

    ID

  • 54

    /

    channels connection /location keepalive WebSocket

    payload

  • 55

    WebTwilio

  • 56

    WebTwilio

    Arduino Uno

    SHT31/HDC1000

    sakura.io

    outboundCall

    IVR

    Turn

    Functions

    outboundwebhook

    inboundwebhook

  • 57

    Twilio https://twilio.kddi-web.com/

    https://twilio.kddi-web.com/

  • 58

  • 59

    SMS4Twilio

  • 60

    https://jp.twilio.com/login/kddi-web

    https://jp.twilio.com/login/kddi-web

  • 62

    Twilio All Products & Services

  • 63

    Buy a Number

  • 64

    Japan (+81)

  • 65

    TYPE 108

  • 66

  • 67

  • 68

    Buy a Number

    Twilio100E.164E.164++810 09012345678E.164+819012345678

  • Functions

    69

    Functions Runtime Functions Beta

  • Functions

    70

    FunctionsManage Configure

  • Functions

    71

    Configuration Enable ACCOUNT_SID and AUTH_TOKEN Environmental Variables 4

    FROM_NUMBER E.164MODULE_ID sakura.ioIDSAKURA_URL sakura.ioIncoming WebhookURLTO_NUMBER E.164

  • Functions

    72

    Dependencies Save

  • Functions

    73

    Functionssakura.ioFunctionsManage

  • Functions

    74

    Blank Create

  • Functions

    75

    Functions FUNCTION NAMEPATH /outbound-call CODE Save https://github.com/sakuraio/handson-sample/blob/master/twilio/outboundcall.js

    https://github.com/sakuraio/handson-sample/blob/master/twilio/outboundcall.js

  • Functions

    76

    FunctionsoutboundCallFunctionsManage

  • Functions

    77

    Blank Create

  • Functions

    78

    Functions FUNCTION NAMEPATH /ivr ACCESS CONTROLCODE Save https://github.com/sakuraio/handson-sample/blob/master/twilio/ivr.js

    https://github.com/sakuraio/handson-sample/blob/master/twilio/ivr.js

  • Functions

    79

    FunctionsIVRFunctionsManage

  • Functions

    80

    Blank Create

  • Functions

    81

    Functions FUNCTION NAMEPATH /ivr ACCESS CONTROLCODE Save https://github.com/sakuraio/handson-sample/blob/master/twilio/ivr.js

    https://github.com/sakuraio/handson-sample/blob/master/twilio/ivr.js

  • Functions

    82

    Twilio Function3sakura.ioPATHOutgoing WebhookManage outboundCall

  • Outgoing Webhook

    83

    Twilio FunctionsPATHPATHURL

  • Outgoing Webhook

    84

    Outgoing Webhook

  • Outgoing Webhook

    85

    Outgoing Webhook Outgoing Webhook

  • Outgoing Webhook

    86

    Outgoing WebhookPayload URLPayload URLTwilio outboundCall PATHURLSecret

  • 87

    Arduino Uno

    SHT31/HDC1000

    outboundCall

    IVR

    Turn

    Functions

    outboundwebhook

    inboundwebhook

    30Twilio FunctionsoutboundCallIVRTurnLED

    30

    Outgoing Webhook

    MODULE_ID

    JSON

  • 89

  • sakura.io

    90

  • sakura.io

    91

  • sakura.io

    92

  • sakura.io

    93

  • sakura.io

    94

  • Twilio

    95

    All Products & Services Runtime Functions Manage Functions Delete this Function

  • Twilio

    96

    All Products & Services Active Numbers Release this Number

  • 97

  • AlphaCompat.ino

    98

    IoT Platform SakuraAlpha_I2C.ino0,1,2

  • Shell.ino

    99

    CR

  • Shell.ino

    100

    version

    version

    >versionv1.0.0-161109-c566dba

  • Shell.ino

    101

    serial

    serial

    >serial16A0100134

  • Shell.ino

    102

    status

    status

    >statusOnlineLast Error Code: 0

  • Shell.ino

    103

    sqi

    sqi

    >sqi5

    50

  • Shell.ino

    104

    unixtimeUTC

    unixtime

    >unixtime1480497574

  • Shell.ino

    105

    update

    update

    >updateCurrent Version: v1.0.0-161109-c566dbaUnlockStarting updateWaiting for update.

  • Shell.ino

    106

    reset

    reset

    >reset>

    1

  • Shell.ino

    107

    enqueue

    enqueue

    >enqueue 0 i 123>

    enqueue32

  • Shell.ino

    108

    send

    send

    >send>

    send161RM172RM

  • Shell.ino

    109

    size/

    size

    >sizeTx Queue

    Avail: 32Queued: 0

    Rx QueueAvail: 32

    Queued: 0

    Tx Queue Rx QueueAvailQueued

  • Shell.ino

    110

    cleartx

    cleartx

    >cleartx>

  • Shell.ino

    111

    clearrx

    clearrx

    >clearrx>

  • Shell.ino

    112

    dequeue

    dequeue

    >dequeueempty

    empty

  • Shell.ino

    113

    peek

    peek

    >peekempty

    empty

  • Standard.ino

    114

    0

  • 115

    DataStore API

  • DataStore API

    116

    sakura.io DataStore API DataStore API

  • DataStore API

    117

    DataStore API

  • DataStore API

    118

    Token Token DataStore v1 Document

  • DataStore API /channels

    119

    /channels value value_num value_str /channels URL https://api.sakura.io/datastore/v1/docs/ Token

    moduleID

    size

    orderASCDESC

    cursor

    after/before

    channel

    https://api.sakura.io/datastore/v1/docs/

  • DataStore API /channels

    120

    {"meta": {

    count: ,cursor: ,match:

    },"results": [

    {channel: ,datetime: ,id: ",module: ",type: ",value: ,value_num: ,value_str: "

    },{"channel": [channelcount

    Try it out! Response Body Request URL

  • typeRMtype

    DataStore API /messages

    121

    /messages RMRMID /messages /messages URL https://api.sakura.io/datastore/v1/docs/

    moduleID

    size

    orderASCDESC

    cursor

    after/before

    https://api.sakura.io/datastore/v1/docs/

  • DataStore API /messages

    122

    {"meta": {

    "count": ,"cursor": ,"match":

    },"results": [

    {datetime: ,"id": ","module": ","payload": {

    "channels": [{

    "channel": ,"type": ","value":

    }

    },"type": "channels"

    },{datetime: [message

    Try it out! Response Body Request URL

  • 123

  • 124

    IoTVPSOK

    Come and join us & Feel free to contact me!

    [email protected] http://www.slideshare.net/MasayaHayashi/lt20151224

    https://www.facebook.com/saku.love.nipponbashi

    mailto:[email protected]://www.slideshare.net/MasayaHayashi/lt20151224

  • 125