Projects

Project represents a collection of workflows that make up the integration.

Import Project (master token)

post/

The importProject mutation can be used to import and overwrite an existing project in your embedded account. This is handy when you want to import projects to your 'production' account from 'staging'.

You can also override project configs while importing by passing configJson in the mutation.

If the project you are importing has a solution associated with it, the solution will be imported as draft That means before you start creating instances for this solution, it has to be published manually through UI.
Required token Notes
Master Obtained from the Tray app UI. Refer this.

The mutation accepts the following arguments:

Argument Required Note
exportedProjectJson Yes Can be obtained either by exporting project json from UI or using the exportProject mutation (refer below)
The JSON must be stringified.
targetProjectId Yes obtained from the url of target Project page: https://app.tray.io/workspaces/{workspaceId}/projects/{projectId}
configJson No Stringified JSON object to override the existing project's config. If passed, a complete list of all config must be provided, with entries matching the same data type as the incoming project.
clientMutationId No Only relevant if using the Relay GraphQL client

Here is an example mutation:

Import Project

mutation {
  importProject (input: {
    exportedProjectJson: "{}",
    targetProjectId: "944dxxx-xxx-xxx-xxx-xxx222eb99",
    configJson: "{\"list_id\":\"udi38969hhb\",\"channel\":\"U17287188\"}"
  }) {
    clientMutationId
  }
}

Import Project with clientMutationId

mutation {
  importProject (input: {
    exportedProjectJson: "{}",
    targetProjectId: "944dxxx-xxx-xxx-xxx-xxx222eb99",
    configJson: "{\"list_id\":\"udi38969hhb\",\"channel\":\"U17287188\"}",
    clientMutationId: "some-mutation-id"
  }) {
    clientMutationId
  }
}

It can return the following data:

Returned Data Notes
clientMutationId while this data is only relevant if using the Relay GraphQL client, it is actually required here as currently this mutation does not return any other data
SecuritybearerAuth
Request
Responses
200

OK - The project is imported to the embedded org

401

Unauthorized

403

Forbidden

500

Internal Error

Request samples
curl -i -X POST \
  https://tray.io/graphql \
  -H 'Authorization: Bearer <MASTER_TOKEN>' \
  -H 'Content-Type: application/json' \
  -d '{
    "query": "mutation ($exportedProjectJson: String!, $targetProjectId: ID!) {\n  importProject (input: {\n    exportedProjectJson: $exportedProjectJson,\n    targetProjectId: $targetProjectId\n  }) {\n    clientMutationId\n  }\n}",
    "variables": {
      "exportedProjectJson": "{}",
      "targetProjectId": "944dxxx-xxx-xxx-xxx-xxx222eb99",
      "configJson": "{\"list_id\":\"udi38969hhb\",\"channel\":\"U17287188\"}"   
    }
  }'
Response samples
application/json
{
  • "data": {
    • "importProject": {
      • "clientMutationId": null
      }
    }
}

Export Project (master token)

post/

The exportProject mutation can be used to export the projects from your embedded account.

This is handy when you want to import project to your 'production' account from 'staging'.

Required token Notes
Master Obtained from the Tray app UI. Refer this.

The mutation accepts the following arguments:

Argument Required Note
projectId Yes obtained from the url of the Project page: https://app.tray.io/workspaces/{workspaceId}/projects/{projectId}
exportSolution Yes Boolean value.
If set to true, the solution associated with the workflow is exported as part of the JSON structure.
clientMutationId No Only relevant if using the Relay GraphQL client

Here is an example mutation:

Export Project

mutation {
  exportProject (input: {
    projectId: "944dxxx-xxx-xxx-xxx-xxx222eb99",
    exportSolution: true
  }) {
    exportedProjectJson
  }
}

It can return the following data:

Returned Data Notes
exportedProjectJson Stringified JSON of the project
SecuritybearerAuth
Request
Responses
200

OK - The JSON string of the exported project is returned

401

Unauthorized

403

Forbidden

500

Internal Error

Request samples
curl -i -X POST \
  https://tray.io/graphql \
  -H 'Authorization: Bearer <MASTER_TOKEN>' \
  -H 'Content-Type: application/json' \
  -d '{
    "query": "mutation ($projectId: ID!) {\n  exportProject (input: {\n    projectId: $projectId,\n    exportSolution: true\n  }) {\n    exportedProjectJson\n  }\n}",
    "variables": {
      "projectId": "944dxxx-xxx-xxx-xxx-xxx222eb99"
    }
  }'
Response samples
application/json
{
  • "data": {
    • "exportProject": {
      • "exportedProjectJson": "{}"
      }
    }
}

Export Project Config (master token)

post/

The exportProjectConfig mutation can be used to export the configs of a project from your embedded account.

Required token Notes
Master Obtained from the Tray app UI. Refer this.

The mutation accepts the following arguments:

Argument Required Note
projectId Yes obtained from the url of the Project page: https://app.tray.io/workspaces/{workspaceId}/projects/{projectId}
clientMutationId No Only relevant if using the Relay GraphQL client

Here is an example mutation:

Export Project

mutation {
  exportProjectConfig (input: {
    projectId: "944dxxx-xxx-xxx-xxx-xxx222eb99"
  }) {
    exportProjectConfigJson
  }
}

It can return the following data:

Returned Data Notes
exportProjectConfigJson Stringified JSON of the project's config
SecuritybearerAuth
Request
Responses
200

OK - The JSON string of the exported project is returned

401

Unauthorized

403

Forbidden

500

Internal Error

Request samples
curl -i -X POST \
  https://{{base_url}}/graphql \
--header 'Authorization: Bearer {{master_token}}' \
--header 'Content-Type: application/json' \
--data '{"query":"mutation ($projectId: ID!) {\n  exportProjectConfig (input: {\n    projectId: $projectId\n  }) {\n    exportProjectConfigJson\n  }\n}","variables":{"projectId":"944dxxx-xxx-xxx-xxx-xxx222eb99"}}'
Response samples
application/json
{
  • "data": {
    • "exportProjectConfig": {
      • "exportProjectConfigJson": "{\"batch_size\":10,\"alert_slack_channel\":\"U055BPQP188\",\"google_sheet_to_salesforce_mapping\":{\"test\":\"test\"},\"spreadsheet_id\":\"1jzs4wKHTWR984lxxxxxxxx_8vSo9Y\",\"worksheet_name\":\"abcd\",\"salesforce_record_type\":\"Lead\",\"interval\":30}"
      }
    }
}