Webhook Configuration Details

List of configuration fields

The following is a list of fields displayed on the Webhook new registration screen.

ItemRequiredDescription
Trigger nameRequiredThe name of the trigger.
Webhook URLrequiredThe URL of the server that will receive Webhook notifications.
Indicator SettingRequiredThe threshold determination information. You can add up to five more.
 IndicatorrequiredSpecify the indicator to be judged.
 ConditionrequiredThe judgment condition of the indicator and threshold.
 ThresholdMandatoryThe threshold of the indicator to be verified.
 weighted average coefficientrequiredSets the weighted average for the indicator.
Value range: 0.0-1.0
ExpressionrequiredSets the formula for judging by multiple indicators.
Input x[0] when there is only one indicator.
Minimum Notification IntervalRequiredSet the interval between Webhook notifications in seconds.
Value range: 60-86400

The following items are added to the Update Webhook screen in addition to the items on the New Webhook screen.

ItemDescription
App IDApp ID
App SecretApp Secret
VerificationBy pressing the button, an HTTP POST request containing a Webhook event object is sent to the currently entered Webhook URL.
The status code of the response should return 200 since verification is considered a success verifier when the response status code is 200.

Configurable Indicators

[data definition…15 seconds interval data] (../basics/definition.html) items in the API can be specified.

Conditions and Thresholds

Threshold judgment is performed on this weighted average calculated. The following five types of threshold judgments are possible. The judgment of the condition is performed by JavaScript.

  • under: weighted average <= threshold
  • over: weighted average >= threshold
  • inner: abs(weighted average) <= threshold
  • outer: abs(weighted average) >= threshold
  • equal: weighted average == threshold

Filtering data according to usage

In the Webhook API operations, the standard filter is isl == false (isl: a flag that becomes false when there is movement in the glasses), and if there are other scenes that you want to exclude, you can add your own conditions. The following is a sample regarding the filter.

SampleIndicatorWeighted AverageThresholdCondition
when the noise time is within 3 secondsnis_time03under
when the walk is 10 steps or morestp010over
when the downward mean angle is shallower than 45tl_yav045under

Weighted average coefficient

The Webhook API performs weighted average processing on data sent from the JINS MEME app to determine triggers. The weighted judgment process is calculated as follows.

  • Previous weighted average value: IndexWA(m-1)
  • This time weighted value: Index(m)
  • Weighted average coefficient (previous value weight): coeff
  • This time weighted average (value used): IndexWA(m) = IndexWA(m-1) * coeff + Index(m-1) * (1 - coeff)

If the weighted average coeff = 0, no weighted average is applied and the current value is determined as is. When the weighted average coeff is close to 1, the most recent value is less likely to be affected.

IndexWA(m-1)Index(m)coeffIndexWA(m)
60800.570
6080080
60800.864

Judgment expression

  • Describe the final judgment expression for the set conditions
  • Only AND(&&), OR(||) and parentheses are allowed. Up to 5 logical operators of ||, && can be set.
  • Note that if you enter an invalid expression, the result will continue to be false and the webhook will not be issued.
  • Example: x[0] || x[1], (x[0] || x[1]) && x[2]

Signature verification method

To verify that the request was sent from JINS MEME, it is possible for the server to verify the signature contained in the request header X-JINSMEME-SIGNATURE.

  1. use the HMAC-SHA256 algorithm with the app secret as the private key to obtain the digest value of the request body
  2. verify that the Base64-encoded value of the digest value matches the signature contained in the X-JINSMEME-SIGNATURE of the request header.

An example of implementing signature verification in JavaScript is shown below.

const crypto = require('crypto');

const secret = '...' // app secret as verified on the Webhook update screen
const body = '...' // request body

const hmac = crypto.createHmac('sha256', secret);
hmac.update(JSON.stringify(body));
const signature = hmac.digest('base64');

SAMPLE.

Posture notification (looking down too much)

  • Condition 1: (tl_yav >= 20, weighted average coefficient = 0)
  • Evaluation formula: x[0]
  • Minimum notification interval: 60

Posture notification (looking down or up too much)

  • Condition 1: (tl_yav >= -20, weighted average coefficient = 0)
  • Condition 2: (tl_yav <= 20, weighted average coefficient = 0)
  • Evaluation formula: x[0] && x[1]
  • Minimum notification interval: 60

Posture notification (walking at a faster pace of 120 (=30x4) steps per minute, with looking down or up too much)

  • Condition 1: (tl_yav >= -20, weighted average coefficient = 0)
  • Condition 2: (tl_yav <= 20, weighted average coefficient = 0)
  • Condition 3: (stp >= 30, weighted average coefficient = 0)
  • Evaluation expressions: x[0] && x[1] && x[2]
  • Minimum notification interval: 60

Long posture notification (looking down or up too much for a longer interval)

  • Condition 1: (tl_yav >= -20, weighted average coefficient = 0.9)
  • Condition 2: (tl_yav <= 20, weighted average coefficient = 0.9)
  • Evaluation formula: x[0] && x[1]
  • Minimum notification interval: 600