Schema for Ratatoskr Device Provider Metadata

From DeviceProviderMetadata.schema.yaml (ratatoskr/DeviceProviderMetadata.schema)

---
$id: https://skeleton.botmd.io/ratatoskr/DeviceProviderMetadata.schema
$schema: http://json-schema.org/draft-07/schema#

title: Device Provider Metadata
description: >-
  `Device.provider_metadata` is used on `Device`s to store provider specific metadata about the device.

type: object
additionalProperties: false
oneOf:
  - required: [botmdhospital]
  - required: [line]
  - required: [messagebird]
  - required: [messenger]
  - required: [mock]
  - required: [noop]
  - required: [pinpoint]
  - required: [promotexter]
  - required: [pusher]
  - required: [qiscus]
  - required: [qontak]
  - required: [ses]
  - required: [smooch]
  - required: [smtp]
  - required: [telegram]
  - required: [twilio]
  - required: [viber]
  - required: [whatsapp]

properties:
  # Providers
  botmdhospital:
    $ref: "#/definitions/botmdhospital"

  line:
    $ref: "#/definitions/line"

  messagebird:
    $ref: "#/definitions/messagebird"

  messenger:
    $ref: "#/definitions/messenger"

  noop:
    $ref: "#/definitions/noop"

  pinpoint:
    $ref: "#/definitions/pinpoint"

  promotexter:
    $ref: "#/definitions/promotexter"

  pusher:
    $ref: "#/definitions/pusher"

  qiscus:
    $ref: "#/definitions/qiscus"

  qontak:
    $ref: "#/definitions/qontak"

  ses:
    $ref: "#/definitions/ses"

  smooch:
    $ref: "#/definitions/smooch"

  smtp:
    $ref: "#/definitions/smtp"

  telegram:
    $ref: "#/definitions/telegram"

  twilio:
    $ref: "#/definitions/twilio"

  viber:
    $ref: "#/definitions/viber"

  whatsapp:
    $ref: "#/definitions/whatsapp"

  # Pseudo-providers
  fcm:
    $ref: "#/definitions/fcm"
#end properties

definitions:
  botmdhospital:
    title: Bot MD Hospital
    description: Device provider metadata for Bot MD Hospital.

    type: object
    additionalProperties: false
    required: []
  #end botmdhospital

  line:
    title: Line
    description: Device provider metadata for Line.

    type: object
    additionalProperties: false
    required: [user_id]

    properties:
      user_id:
        title: User ID
        description: The user ID assigned by Line.
        type: string
        pattern: "^U[0-9a-f]{32}$"
      #end user_id

      display_name:
        title: Display Name
        description: User's display name
        type: string
      #end display_name

      language:
        title: Language
        description: User's language, as a [BCP 47](https://www.rfc-editor.org/info/bcp47) language tag. e.g. `en` for English.
        type: string
      #end language

      access_token:
        title: Access Token
        description: Access token obtained via Line login.
        type: string
      #end access_token

      is_follower:
        title: Is Follower
        description: Is this user a follower of the bot?
        type: boolean
      #end is_follower

      is_follower_updated_on:
        title: Is Follower Updated On
        description: Date-time of last verification of follower status.
        type: string
        format: date-time
      #end is_follower_checked_on
    #end properties
  #end line

  messagebird:
    title: Messagebird
    description: Device provider metadata for Messagebird.

    type: object
    additionalProperties: false
    required: []

    properties:
      conversation_id:
        title: Messagebird Conversation ID
        description: The conversation ID that Messagebird uses to identify the conversation that the user has, a conversation can take place over more than 1 channel.
        type: [string, "null"]
        pattern: '^[A-Za-z0-9\+\/]+$'
      #end conversation_id

      contact_id:
        title: Messagebird Contact ID
        description: The contact ID that Messagebird uses to identify the user.
        type: [string, "null"]
        pattern: '^[A-Za-z0-9\+\/]+$'
      #end contact_id
    #end properties
  #end messagebird

  messenger:
    title: Messenger
    description: Device provider metadata for Messenger.

    type: object
    additionalProperties: false
    required: [psid]

    properties:
      psid:
        title: Page Scoped ID
        description: The ID that Messenger uses to identify the user.
        type: string
        pattern: "^[0-9]+$"
      #end psid

      fb_profile_id:
        title: Facebook Profile ID
        description: The user's Facebook profile `id`. Present only if allowed by the user.
        type: string
        minLength: 1
      #end fb_profile_id

      fb_profile_name:
        title: Facebook Profile Name
        description: The user's Facebook profile `name`. Present only if allowed by the user.
        type: string
        minLength: 1
      #end fb_profile_name

      notification_messages_token:
        title: Notification Messages Token
        description: Notification messages token obtained via the [Messaging Optins webhook](https://developers.facebook.com/docs/messenger-platform/reference/webhook-events/messaging_optins) from [Send to Messenger plugin](https://developers.facebook.com/docs/messenger-platform/discovery/send-to-messenger-plugin).
        type: string
        minLength: 1
      #end notification_messages_token

      notification_messages_token_expiry_timestamp:
        title: Notification Messages Token Expiry Timestamp
        description: Date-time for when the `notification_messages_token` will expire.
        type: string
        format: date-time
      #end notification_messages_token_expiry_timestamp
    #end properties
  #end messenger

  noop:
    title: Noop
    description: Device provider metadata for `NoopProvider` and `NoopPhoneProvider`.

    type: object
    additionalProperties: false
    required: []
  #end noop

  pinpoint:
    title: Noop
    description: Device provider metadata for `NoopProvider` and `NoopPhoneProvider`.

    type: object
    additionalProperties: false
    required: []
  #end pinpoint

  promotexter:
    title: PromoTexter
    description: Device provider metadata for PromoTexter.

    type: object
    additionalProperties: false
    required: []
  #end promotexter

  pusher:
    title: Pusher
    description: Device provider metadata for Pusher.

    type: object
    additionalProperties: false
    required: [channel]

    properties:
      channel:
        title: Channel ID
        description: The Pusher channel ID this device is using. Convention dictates that it follows the form `private-encrypted-<device uid>`.
        type: string
        pattern: '^private\-[a-zA-Z0-9\-]+$'

      socket_id:
        title: Socket ID
        description: The Pusher socket ID this device is currently using. This is set during the channel authentication step and could be overwritten if there are multiple devices connected.
        type: string
        pattern: '^[0-9\.]+$'
    #end properties
  #end pusher

  qiscus:
    title: Qiscus
    description: Device provider metadata for Qiscus.

    type: object
    additionalProperties: false
    required: [channel]

    properties:
      channel:
        title: Channel
        description: The Qiscus channel that this device is on.
        enum: [wa]

      room_id:
        title: Room ID
        description: The room ID used by multichannel API. It may not have a room when this device has not been used directly with multichannel API (i.e., outgoing deliveries only through the WhatsApp API).
        type: string
      #end room_id

      name:
        title: Name
        description: The channel specific user name, e.g., profile name in WhatsApp. This field can be an empty string.
        type: string
      #end name
    #end properties
  #end qiscus

  qontak:
    title: Qontak
    description: Device provider metadata for Qontak.

    type: object
    additionalProperties: false
    required: [phone_no]

    properties:
      room_id:
        title: Room ID
        description: The room ID provided from Qontak. It defines an interaction from customer to Qontak side which message will be forwarded to our side.
        type: string
      #end room_id

      name:
        title: Name
        description: The recipient Name provided from Qontak. It defines an customer name to Qontak side.
        type: string
      #end room_id

      phone_no:
        title: Phone No
        description: Customer's phone no identifier.
        type: string
    #end properties
  #end qontak

  ses:
    title: SESProvider
    description: Device provider metadata for SESProvider.

    type: object
    additionalProperties: false
    required: [email]

    properties:
      email:
        title: Email
        description: The email address.
        type: string
        anyOf:
          - format: email
          - format: idn-email
      #end email

      name:
        title: Name
        description: The name the sender (if provided).
        type: string
      #end name
  #end ses

  smooch:
    title: Smooch (Deprecated)
    description: Device provider metadata for Smooch.

    type: object
    additionalProperties: false
    required: [app_id]

    properties:
      app_id:
        title: App ID
        description: The Smooch App ID.
        type: string
        minLength: 1

      conversation_id:
        title: Conversation ID
        description: The Smooch conversation ID.
        type: [string, "null"]
        minLength: 1

      client:
        title: Raw client metadata
        description: This is Smooch provided `client` dictionary that we store for analytics purposes.

        oneOf:
          - type: object
          - const: null
    #end properties
  #end smooch

  smtp:
    title: SMTP
    description: Device provider metadata for SMTP.

    type: object
    additionalProperties: false
    required: [email]

    properties:
      email:
        title: Email
        description: The email address.
        type: string
        anyOf:
          - format: email
          - format: idn-email
      #end email

      name:
        title: Name
        description: The name the sender (if provided).
        type: string
      #end name
    #end properties
  #end smtp

  telegram:
    title: TelegramProvider
    description: Device provider metadata for TelegramProvider.

    type: object
    additionalProperties: false
    required: [chat_id, username]

    properties:
      chat_id:
        title: Chat ID
        description: Telegram internal `chat_id` for use with the API. This is usually the same as the user ID.
        type: integer
      #end chat_id

      username:
        title: Username
        description: The username of the sender. `null` for messages sent to channels.
        anyOf:
          - type: string
            minLength: 1
          - type: "null"

      user_metadata:
        title: User Metadata
        description: Additional information about the user returned by Telegram.
        type: object
        additionalProperties: true
    #end properties
  #end telegram

  twilio:
    title: Twilio
    description: Device provider metadata for Twilio.

    type: object
    additionalProperties: false
    required: []
  #end twilio

  viber:
    title: Viber
    description: Device provider metadata for Viber.

    type: object
    additionalProperties: false
    required: [user_id]

    properties:
      user_id:
        title: User ID
        description: The user ID assigned by Viber.
        type: string
        minLength: 1

      display_name:
        title: Display Name
        description: User's display name
        type: string

      language:
        title: Language
        description: User's language, as a [BCP 47](https://www.rfc-editor.org/info/bcp47) language tag. e.g. `en` for English.
        type: string

      is_follower:
        title: Is Follower
        description: Is this user a follower of the bot?
        type: boolean

      is_follower_updated_on:
        title: Is Follower Updated On
        description: Date-time of last verification of follower status.
        type: string
        format: date-time

  whatsapp:
    title: WhatsApp
    description: Device provider metadata for WhatsApp by Meta.

    type: object
    additionalProperties: false
    required: [wa_id]

    properties:
      wa_id:
        title: WhatsApp ID
        description: WhatsApp ID associated with the device. Usually the phone number in E.164 format without `+`.
        type: string
        pattern: '^\d{5,}$'

      name:
        title: Name
        description: Name of user as used on their WhatsApp account.
        type: string
        minLength: 1
    #end properties
  #end whatsapp

  fcm:
    title: FCM
    description: Device provider metadata for FCM.

    type: object
    additionalProperties: false
    required: [token, os]

    properties:
      token:
        title: Token
        description: The device registration token.
        type: [string, "null"]
        minLength: 1

      os:
        title: Operating System
        description: The device operating system.
        enum: [ios, android]
    #end properties
  #end fcm
#end definitions

[Main Page] [Schema Documentation] [Examples]