Fyno Manage User Subscriptions & Preferences API

The Manage User Subscriptions & Preferences API from Fyno — 2 operation(s) for manage user subscriptions & preferences.

OpenAPI Specification

fyno-manage-user-subscriptions-preferences-api-openapi.yml Raw ↑
openapi: 3.0.2
info:
  title: Fyno Rest Fire an Event Manage User Subscriptions & Preferences API
  version: v1
servers:
- url: https://api.fyno.io/v1
security:
- BearerAuth: []
tags:
- name: Manage User Subscriptions & Preferences
paths:
  /{WSID}/{version}/subscriptions/preference:
    get:
      tags:
      - Manage User Subscriptions & Preferences
      summary: Get user preference
      description: This API enables you to get all the subscriptions topics (with sections) defined in your workspace along with the opted-in/opted-out preference of a particular user.
      parameters:
      - name: WSID
        in: path
        description: Enter your workspace ID. You can obtain this value from the API Keys page within your Fyno account.
        required: true
        style: simple
        explode: false
        schema:
          type: string
        example: FYXXXXXXXX
      - name: version
        in: path
        description: Specify the version for which you would like to manage the user profile.
        required: true
        style: simple
        explode: false
        schema:
          type: string
          default: live
          enum:
          - live
          - test
      - name: distinct_id
        in: query
        description: Enter the distinct ID that you currently use to identify the user.
        required: true
        style: form
        explode: true
        schema:
          type: string
        example: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
      - name: event_list
        in: query
        description: Set this value to 'true' to receive list of notification events attached to each subscription topic.
        required: false
        style: form
        explode: false
        schema:
          type: boolean
          default: false
          enum:
          - true
          - false
        example: false
      responses:
        '200':
          $ref: '#/components/responses/PrefProfileFetched'
        '400':
          $ref: '#/components/responses/DistinctIDMissing'
        '401':
          $ref: '#/components/responses/APIKeyInvalid'
    put:
      tags:
      - Manage User Subscriptions & Preferences
      summary: Update user preference
      description: This API enables you to update the channel preference of a user for multiple subscription topics. In the JSON payload, enter the subscription ID as keys to update the channel preference. To update the user preference for all subscription topics at once (global preference), use 'all' instead of the subscription id.<br/><br/>**Note&#58;** If the channel configuration for a subscription topic is set to 'required', then the user preference for the channel cannot be updated.
      parameters:
      - name: WSID
        in: path
        description: Enter your workspace ID. You can obtain this value from the API Keys page within your Fyno account.
        required: true
        style: simple
        explode: false
        schema:
          type: string
        example: FYXXXXXXXX
      - name: version
        in: path
        description: Specify the version for which you would like to manage the user profile.
        required: true
        style: simple
        explode: false
        schema:
          type: string
          default: live
          enum:
          - live
          - test
      - name: distinct_id
        in: query
        description: Enter the distinct ID that you currently use to identify the user.
        required: true
        style: form
        explode: true
        schema:
          type: string
        example: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/update_subscription_multiple'
        required: true
      responses:
        '200':
          $ref: '#/components/responses/SubscriptionUpdated'
        '400':
          $ref: '#/components/responses/DistinctIDChannelStatusMissing'
        '401':
          $ref: '#/components/responses/APIKeyInvalid'
  /{WSID}/{version}/subscriptions/list/{subscription_id}/user:
    post:
      tags:
      - Manage User Subscriptions & Preferences
      summary: Update user preference (single)
      description: This API enables you to update the channel preference of a user for a particular subscription topic.<br/><br/>**Note&#58;** If the channel configuration for a subscription topic is set to 'required', then the user preference for the channel cannot be updated.
      parameters:
      - name: WSID
        in: path
        description: Enter your workspace ID. You can obtain this value from the API Keys page within your Fyno account.
        required: true
        style: simple
        explode: false
        schema:
          type: string
        example: FYXXXXXXXX
      - name: version
        in: path
        description: Specify the version for which you would like to manage the user profile.
        required: true
        style: simple
        explode: false
        schema:
          type: string
          default: live
          enum:
          - live
          - test
      - name: subscription_id
        in: path
        description: Enter the subscription ID to update the channel preference for the subscription topic. To update the user preference for all subscription topics at once (global preference), use 'all' instead of the subscription id.
        required: true
        style: simple
        explode: true
        schema:
          type: string
        example: SXXXXXXXXX
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/update_subscription_single'
        required: true
      responses:
        '200':
          $ref: '#/components/responses/SubscriptionUpdated'
        '400':
          $ref: '#/components/responses/DistinctIDChannelStatusMissing'
        '401':
          $ref: '#/components/responses/APIKeyInvalid'
components:
  schemas:
    update_subscription_single:
      properties:
        channel:
          enum:
          - sms
          - whatsapp
          - email
          - discord
          - slack
          - teams
          - push
          - voice
          - inapp
          - webpush
          type: string
        distinct_id:
          type: string
        status:
          enum:
          - opted-in
          - opted-out
          type: string
      type: object
      required:
      - channel
      - distinct_id
      - status
    preference_channels_opted_out:
      properties:
        discord:
          enum:
          - opted-out
          type: string
        email:
          enum:
          - opted-out
          type: string
        inapp:
          enum:
          - opted-out
          type: string
        push:
          enum:
          - opted-out
          type: string
        slack:
          enum:
          - opted-out
          type: string
        sms:
          enum:
          - opted-out
          type: string
        teams:
          enum:
          - opted-out
          type: string
        voice:
          enum:
          - opted-out
          type: string
        whatsapp:
          enum:
          - opted-out
          type: string
      type: object
    update_subscription_multiple:
      properties:
        user_preference:
          properties:
            SXXXXXXXXX:
              $ref: '#/components/schemas/preference_channels'
          type: object
      type: object
      required:
      - user_preference
    updated_at:
      properties:
        discord:
          type: string
        email:
          type: string
        inapp:
          type: string
        push:
          type: string
        slack:
          type: string
        sms:
          type: string
        teams:
          type: string
        voice:
          type: string
        webpush:
          type: string
        whatsapp:
          type: string
      type: object
    preference_channels:
      properties:
        discord:
          default: opted-in
          enum:
          - opted-out
          - opted-in
          type: string
        email:
          default: opted-in
          enum:
          - opted-out
          - opted-in
          type: string
        inapp:
          default: opted-in
          enum:
          - opted-out
          - opted-in
          type: string
        push:
          default: opted-in
          enum:
          - opted-out
          - opted-in
          type: string
        slack:
          default: opted-in
          enum:
          - opted-out
          - opted-in
          type: string
        sms:
          default: opted-in
          enum:
          - opted-out
          - opted-in
          type: string
        teams:
          default: opted-in
          enum:
          - opted-out
          - opted-in
          type: string
        voice:
          default: opted-in
          enum:
          - opted-out
          - opted-in
          type: string
        webpush:
          default: opted-in
          enum:
          - opted-out
          - opted-in
          type: string
        whatsapp:
          default: opted-in
          enum:
          - opted-out
          - opted-in
          type: string
      type: object
  responses:
    APIKeyInvalid:
      description: API Key or Workspace ID is invalid. User is unauthorised.
      content:
        application/json:
          schema:
            properties:
              _message:
                example: Invalid API details
                type: string
              status:
                example: error
                type: string
            type: object
            required:
            - _message
            - status
    PrefProfileFetched:
      description: Preference fetched successfully
      content:
        application/json:
          schema:
            required:
            - meta
            - result
            properties:
              meta:
                required:
                - all
                properties:
                  all:
                    required:
                    - preference
                    - updated_at
                    properties:
                      preference:
                        $ref: '#/components/schemas/preference_channels_opted_out'
                      updated_at:
                        $ref: '#/components/schemas/updated_at'
                    type: object
                type: object
              result:
                required:
                - Section1
                properties:
                  Section1:
                    items:
                      required:
                      - channel_config
                      - description
                      - is_global_opted_out
                      - name
                      - notification_events
                      - preference
                      - subscription_id
                      - updated_at
                      properties:
                        channel_config:
                          properties:
                            discord:
                              default: 'on'
                              enum:
                              - 'on'
                              - 'off'
                              - required
                              type: string
                            email:
                              default: 'on'
                              enum:
                              - 'on'
                              - 'off'
                              - required
                              type: string
                            inapp:
                              default: 'on'
                              enum:
                              - 'on'
                              - 'off'
                              - required
                              type: string
                            push:
                              default: 'on'
                              enum:
                              - 'on'
                              - 'off'
                              - required
                              type: string
                            slack:
                              default: 'on'
                              enum:
                              - 'on'
                              - 'off'
                              - required
                              type: string
                            sms:
                              default: 'on'
                              enum:
                              - 'on'
                              - 'off'
                              - required
                              type: string
                            teams:
                              default: 'on'
                              enum:
                              - 'on'
                              - 'off'
                              - required
                              type: string
                            voice:
                              default: 'on'
                              enum:
                              - 'on'
                              - 'off'
                              - required
                              type: string
                            webpush:
                              default: 'on'
                              enum:
                              - 'on'
                              - 'off'
                              - required
                              type: string
                            whatsapp:
                              default: 'on'
                              enum:
                              - 'on'
                              - 'off'
                              - required
                              type: string
                          type: object
                        description:
                          type: string
                        is_global_opted_out:
                          properties:
                            discord:
                              enum:
                              - true
                              type: boolean
                            email:
                              enum:
                              - true
                              type: boolean
                            inapp:
                              enum:
                              - true
                              type: boolean
                            push:
                              enum:
                              - true
                              type: boolean
                            slack:
                              enum:
                              - true
                              type: boolean
                            sms:
                              enum:
                              - true
                              type: boolean
                            teams:
                              enum:
                              - true
                              type: boolean
                            voice:
                              enum:
                              - true
                              type: boolean
                            webpush:
                              enum:
                              - true
                              type: boolean
                            whatsapp:
                              enum:
                              - true
                              type: boolean
                          type: object
                        name:
                          type: string
                        notification_events:
                          items:
                            properties:
                              event_id:
                                type: string
                              event_name:
                                type: string
                            type: object
                          type: array
                        preference:
                          $ref: '#/components/schemas/preference_channels'
                        subscription_id:
                          type: string
                        updated_at:
                          $ref: '#/components/schemas/updated_at'
                      type: object
                    type: array
                type: object
            type: object
    DistinctIDMissing:
      description: Distinct ID is not provided
      content:
        application/json:
          schema:
            properties:
              _message:
                example: distinct_id is required to list preference!
                type: string
              status:
                example: error
                type: string
            type: object
            required:
            - _message
            - status
    SubscriptionUpdated:
      description: Subscription updated successfully
      content:
        application/json:
          schema:
            required:
            - SXXXXXXXXX
            properties:
              SXXXXXXXXX:
                $ref: '#/components/schemas/preference_channels'
            type: object
    DistinctIDChannelStatusMissing:
      description: Distinct ID, channel, or status is not provided
      content:
        application/json:
          schema:
            properties:
              _message:
                example: distinct_id is required!
                type: string
              status:
                example: error
                type: string
            type: object
            required:
            - _message
            - status
  securitySchemes:
    BearerAuth:
      type: http
      description: Enter your API Key. If you don't have it already, you can create one from the API Keys page within your Fyno account
      scheme: bearer
      x-fern-bearer:
        name: apiKey
        env: FYNO_API_KEY