Options
All
  • Public
  • Public/Protected
  • All
Menu
label

OAUTH

description

The web hooks controller of the app. Handles requests that are issued from third-party data providers such as Strava or Apple Health.

This controller defines the following routes:

URI HTTP method Class method Description
/webhook/:provider GET WebHooksController.subscribe Accepts a hub in the request query that must contain fields: verify_token and challenge. Responds with the challenge as attached to the request only if the verification token is valid.
/webhook/:provider POST WebHooksController.event Accepts an activity object in the request body and uses it to store the activity headers as attached in the request.


since

v0.3.2

Hierarchy

  • WebHooksController

Index

Constructors

Methods

Constructors

Methods

  • event(response: Response<any, Record<string, any>>, providerName: string, data: BasicWebHookEventRequest): Promise<Response<any, Record<string, any>>>
  • This endpoint is called by third-party data providers to create or update events for remote accounts, e.g. upon activity completion.

    method

    GET

    access

    protected

    async

    Parameters

    • response: Response<any, Record<string, any>>

      An express response object that will be used to attach the challenge when verification succeeds.

    • providerName: string
    • data: BasicWebHookEventRequest

    Returns Promise<Response<any, Record<string, any>>>

  • subscribe(response: Response<any, Record<string, any>>, providerName: string, challenge: string, verify_token: string): Promise<Response<any, Record<string, any>>>
  • This endpoint is called by third-party data providers to initially create webhook subscriptions for remote accounts.

    This endpoint is secured by a provider verification token that must be attached to the request and that must match the runtime's configuration.

    method

    GET

    access

    protected

    async
    throws

    {HttpException} Given an invalid verification token or no verification token is present.

    Parameters

    • response: Response<any, Record<string, any>>

      An express response object that will be used to attach the challenge when verification succeeds.

    • providerName: string

      A third-party data provider name, e.g. "strava".

    • challenge: string
    • verify_token: string

    Returns Promise<Response<any, Record<string, any>>>

    Promise An express response object that contains the verification challenge as attached in the request.

Generated using TypeDoc