Settings API

The Settings API is an integral component of the core service. As a result, all requests should be directed to: https://api.subsbase.io/core/v2/graphql.

The core service expects 2 headers, the X-SITE-ID and Authorization so the request would be:

POST https://api.subsbase.io/core/v2/graphql
Authorization: Bearer {server token}
X-SITE-ID: {your site id}
Consuming the Settings API requires that a server token is used to authenticate the request. The server token is expected in the Authorization header.

Site Info Query

query GetSiteInfo($siteId: String!) { 
    siteInfo (siteId: $siteId) {
        isSuccess
        message
        value {
            name
            #All properties are found in the SiteInfoGQLType
        }
    } 
}
// Variables Sample:
{"siteId":"test-site"}

Subscription Events Queries

Subscription Events

query GetSubscriptionEvents($siteId: String!,$filter: FilterGQLInputType,$pagination: PaginationGQLInputType,$sorting: [SortingGQLInputType]) { 
    subscriptionEvents (siteId: $siteId,filter: $filter,pagination: $pagination,sorting: $sorting) {
        isSuccess
        data{
            id
            #All properties are found in the SubscriptionEventGQLType
        }
        message
    } 
}
// Variables Sample:
{
  "siteId": "test-site",
  "pagination": {
    "page": 1,
    "perPage": 20
  },
  "filter": null,
  "sorting": [
    {
      "field": "Info.Index",
      "direction": "Descending"
    }
  ]
}

Available Subscription Event Placeholders

query GetAvailableSubscriptionEventPlaceholders($siteId: String!) {
   availableSubscriptionEvents (siteId: $siteId) {
       name
   #All properties are found in the SubscriptionEventPlaceholderGQLType
   }
}
// Variables Sample
{"siteId":"test-site"
}

Subscription Events Mutation

Add Subscription Events

  • To update an existing subscription event, you need to use the following Mutation, it is advisable to use variables in this case since the input types are more complex than just strings:
mutation AddSubscriptionEvent(
    $siteId: String!
    $event: SubscriptionEventGQLInputType!
) {
    subscriptionEvents(siteId: $siteId) {
        add(event: $event) {
            isSuccess
            message
        }
    }
}
// Variables Sample:
{
  "siteId": "test-site",
  "event": {
    "subscriptionEventId": "invoice-payment-link",
    "name": "test",
    "siteId": "test-site",
    "delay": {
      "delayType": "None"
    },
    "actions": [
      {
        "isEnabled": true,
        "name": "Send email to ",
        "email": {
          "fromDisplayName": "Subsbase",
          "subject": "test subject",
          "body": "<p>test body</p>",
          "to": "{{Customer.EmailAddress}}",
          "cC": "",
          "bCC": ""
        },
        "sms": null,
        "chatMessaging": null,
        "webhook": null
      }
    ],
    "conditions": {
      "name": "",
      "value": null,
      "operands": [],
      "operation": "AlwaysTrue",
      "valueType": null
    },
    "info": {
      "index": 24
    }
  },
  "siteSubscriptionEventId": ""
}