Sunshine Workflows Sunshine Tasks

Important: The Sunshine Workflows API is in early access. This API is subject to change and should not be used in a production environment. Visit the Sunshine Workflows API EAP forum to provide feedback.

You can define the following Sunshine tasks for your Sunshine Workflows:

Update a Sunshine Custom Object

Updates a custom object in Zendesk Support.

JSON Format
Name Type Required Comment
input object yes Contains fields necessary for the task. See the input object description.
key string yes A name given to the task. Note the key must be unique in the context of the entire workflow.`
type string yes The type of task to execute. Must be "UPDATE_CUSTOM_OBJECT".
description string no A short description of your task for you and your team to reference.
optional boolean no Defaults to false. A boolean value can be set for any task in the workflow. If set to true, the task failure will not interrupt the workflow execution.

input object

Name Type Required Comment
object_id string yes Identifies the target of the update.
data object no Contains the updated information of the object. See the Sunshine API.
Example

The following example demonstrates a task named "foo_update_custom_object" of type UPDATE_CUSTOM_OBJECT.

{
  "type": "UPDATE_CUSTOM_OBJECT",
  "key": "foo_update_custom_object",
  "input": {
    "object_id": "foo_update_custom_object_id",
    "data": {
      "attributes": {
        "key": "value"
      }
    }
  }
}

Create a Sunshine Custom Object

Creates a custom object in Zendesk Support.

JSON Format
Name Type Required Comment
input object yes Contains fields necessary for the task. See the input object description.
key string yes A name given to the task. Note the key must be unique in the context of the entire workflow.
type string yes The type of task to execute. Must be "CREATE_CUSTOM_OBJECT".
description string no A short description of your task for you and your team to reference.
optional boolean no Defaults to false. A boolean value can be set for any task in the workflow. If set to true, the task failure will not interrupt the workflow execution.

input object

Name Type Required Comment
data object yes Contains the data necessary to create the custom object. See the data object description.

data object

Name Type Comment
type string Corresponds with the type of custom object you are attempting to instantiate.
attributes object Contains the data you wish to store in the custom object, where the fields must adhere to the schema associated with this object type. See the Sunshine API for more information on acceptable attributes.
Example

In the below example, the task named "create_foobar_object" creates a brand new custom object record of the predefined type foobar, whose schema requires only a single mandatory field named key. In the input.data.attributes object, the key field is assigned to equal "123". Additionally, this task uses the external_id field, which is a unique identifier for the object that is usually sourced from an existing data store that contains this object.

{
  "type": "CREATE_CUSTOM_OBJECT",
  "key": "create_foobar_object",
  "input": {
    "data": {
      "type": "foobar",
      "external_id": "foo_external_id",
      "attributes": {
        "key": "123"
      }
    }
  }
}

Create a Sunshine Relationship Record

Creates a Sunshine relationship record.

JSON Format
Name Type Required Comment
input object yes Contains fields necessary for the task. See the input object description.
key string yes A name given to the task. Note the key must be unique in the context of the entire workflow.
type string yes The type of task to execute. Must be "CREATE_RELATIONSHIP_RECORD".
description string no A short description of your task for you and your team to reference.
optional boolean no Defaults to false. A boolean value can be set for any task in the workflow. If set to true, the task failure will not interrupt the workflow execution.

input object

Name Type Required Comment
data object yes Contains the data necessary to create the relationship record. See the Sunshine API documentation.
Example

In the following example, the task named "create_sunshine_rel" creates a Sunshine relationship of type copier_has_many_tickets between the source entity and the target entity, each given by their respective ID's.

{
  "type": "CREATE_RELATIONSHIP_RECORD",
  "key": "create_sunshine_rel",
  "input": {
    "data": {
      "relationship_type": "copier_has_many_tickets",
      "source": "1c771ee0-2c3f-11e7-bf60-e5c3f630b5aa",
      "target": "35437746"
    }
  }
}

Read a Sunshine Custom Object

Reads a Sunshine custom object.

JSON Format
Name Type Comment
input object Contains fields necessary for the task. There are many ways to read a Sunshine custom object. See the respective descriptions:
key string A name given to the task. Note the key must be unique in the context of the entire workflow.
type string The type of task to execute. Must be "READ_CUSTOM_OBJECT".
description string A short description of your task for you and your team to reference.
optional boolean Defaults to false. A boolean value can be set for any task in the workflow. If set to true, the task failure will not interrupt the workflow execution.

By ID input object

Name Type Required Comment
by string yes Must be "id".
id string yes The id of the custom object.
Example
{
  "type": "READ_CUSTOM_OBJECT",
  "key": "example_read_custom_object_by_id",
  "description": "Example for READ_CUSTOM_OBJECT",
  "input": {
    "by": "id",
    "id": "14c6c4be-cb64-4678-ba73-296e3d2c32cf"
  }
}

Response

{
  "data": {
    "id": "14c6c4be-cb64-4678-ba73-296e3d2c32cf",
    "type": "product",
    "external_id": "3",
    "attributes": {
      "id": "3",
      "name": "Strawberry Chewing Gum"
    },
    "created_at": "2017-01-03T12:35:45Z",
    "updated_at": "2017-01-03T12:35:45Z"
  }
}

See Show Object Record in the Sunshine API docs for more info.

By IDs input object

Name Type Required Comment
by string yes Must be "ids".
ids array yes An array of custom object ids.
Example
{
  "type": "READ_CUSTOM_OBJECT",
  "key": "example_read_custom_object_by_ids",
  "description": "Example for READ_CUSTOM_OBJECT",
  "input": {
    "by": "ids",
    "ids": [
      "14c6c4be-cb64-4678-ba73-296e3d2c32cf",
      "d07b6206-1ea1-43c4-ae68-ef743aa36169"
    ]
  }
}

Response

{
  "data": [
    {
      "id": "14c6c4be-cb64-4678-ba73-296e3d2c32cf",
      "type": "product",
      "type_version": 1,
      "external_id": "3",
      "attributes": {
        "id": "3",
        "name": "Strawberry Chewing Gum"
      },
      "created_at": "2017-01-03T12:35:45Z",
      "updated_at": "2017-01-03T12:35:45Z"
    },
    {
      "id": "d07b6206-1ea1-43c4-ae68-ef743aa36169",
      "type": "product",
      "type_version": 1,
      "external_id": "4",
      "attributes": {
        "id": "4",
        "name": "Coffee Chewing Gum"
      },
      "created_at": "2017-01-03T12:35:45Z",
      "updated_at": "2017-01-03T12:35:45Z"
    }
  ]
}

See List Object Records By Id in the Sunshine API docs for more info. Note that the pagination options are not supported here.

By Type input object

Name Type Required Comment
by string yes Must be "type".
type string yes A string representing an object type key
Example
{
  "type": "READ_CUSTOM_OBJECT",
  "key": "example_read_custom_object_by_type",
  "description": "Example for READ_CUSTOM_OBJECT",
  "input": {
    "by": "type",
    "type": "product"
  }
}

Response

{
  "data": [
    {
      "id": "14c6c4be-cb64-4678-ba73-296e3d2c32cf",
      "type": "product",
      "type_version": 1,
      "external_id": "3",
      "attributes": {
        "id": "3",
        "name": "Strawberry Chewing Gum"
      },
      "created_at": "2017-01-03T12:35:45Z",
      "updated_at": "2017-01-03T12:35:45Z"
    },
    {
      "id": "d07b6206-1ea1-43c4-ae68-ef743aa36169",
      "type": "product",
      "type_version": 1,
      "external_id": "4",
      "attributes": {
        "id": "4",
        "name": "Coffee Chewing Gum"
      },
      "created_at": "2017-01-03T12:35:45Z",
      "updated_at": "2017-01-03T12:35:45Z"
    }
  ],
  "links": {
    "previous": null,
    "next": null
  }
}

See List Object Records By Type in the Sunshine API docs for more info. Note that the pagination options are not supported here.

By Related input object

Name Type Required Comment
by string yes Must be "related".
id string yes An object record ID.
relationship_type string yes A field representing a relationship type key
Example
{
  "type": "READ_CUSTOM_OBJECT",
  "key": "example_read_custom_object_by_related",
  "description": "Example for READ_CUSTOM_OBJECT",
  "input": {
    "by": "related",
    "id": "14c6c4be-cb64-4678-ba73-296e3d2c32cf",
    "relationship_type": "product_relationship"
  }
}

Response

{
  "data": [
    {
      "id": "14c6c4be-cb64-4678-ba73-296e3d2c32cf",
      "type": "product",
      "type_version": 1,
      "external_id": "3",
      "attributes": {
        "id": "3",
        "name": "Strawberry Chewing Gum"
      },
      "created_at": "2017-01-03T12:35:45Z",
      "updated_at": "2017-01-03T12:35:45Z"
    },
    {
      "id": "d07b6206-1ea1-43c4-ae68-ef743aa36169",
      "type": "product",
      "type_version": 1,
      "external_id": "4",
      "attributes": {
        "id": "4",
        "name": "Coffee Chewing Gum"
      },
      "created_at": "2017-01-03T12:35:45Z",
      "updated_at": "2017-01-03T12:35:45Z"
    }
  ],
  "links": {
    "previous": null,
    "next": null
  }
}

See List Related Object Records in the Sunshine API docs for more info. Note that the pagination options are not supported here.

By External input object

Name Type Required Comment
by string yes Must be "external".
type string yes A field representing an object type key
external_id string or array of strings yes A field representing a relationship type key. It can be either a string representing a single external ID or an array representing multiple external IDs
Example
{
  "type": "READ_CUSTOM_OBJECT",
  "key": "example_read_custom_object_by_external",
  "description": "Example for READ_CUSTOM_OBJECT",
  "input": {
    "by": "external",
    "type": "product",
    "external_id": ["3", "4"]
  }
}

Response

{
  "data": [
    {
      "id": "14c6c4be-cb64-4678-ba73-296e3d2c32cf",
      "type": "product",
      "type_version": 1,
      "external_id": "3",
      "attributes": {
        "id": "3",
        "name": "Strawberry Chewing Gum"
      },
      "created_at": "2017-01-03T12:35:45Z",
      "updated_at": "2017-01-03T12:35:45Z"
    },
    {
      "id": "d07b6206-1ea1-43c4-ae68-ef743aa36169",
      "type": "product",
      "type_version": 1,
      "external_id": "4",
      "attributes": {
        "id": "4",
        "name": "Coffee Chewing Gum"
      },
      "created_at": "2017-01-03T12:35:45Z",
      "updated_at": "2017-01-03T12:35:45Z"
    }
  ],
  "links": {
    "previous": null,
    "next": null
  }
}

See Show Object Record By External Id in the Sunshine API docs for more info. Note that the pagination options are not supported here.

Read a Sunshine Relationship Record

Reads a Sunshine relationship record.

JSON Format
Name Type Required Comment
input object yes Contains fields necessary for the task. There are many ways to read a Sunshine custom object. See the respective descriptions:
key string yes A name given to the task. Note the key must be unique in the context of the entire workflow.
type string yes The type of task to execute. Must be "READ_RELATIONSHIP_RECORD".
description string no A short description of your task for you and your team to reference.
optional boolean no Defaults to false. A boolean value can be set for any task in the workflow. If set to true, the task failure will not interrupt the workflow execution.

By ID input object

Name Type Required Comment
by string yes Must be "related".
id string yes The relationship record ID.
Example
{
  "type": "READ_RELATIONSHIP_RECORD",
  "key": "example_read_relationship_record_by_id",
  "description": "Example for READ_RELATIONSHIP_RECORD",
  "input": {
    "by": "id",
    "id": "1a034055-6485-11ea-a338-a7395da450f1"
  }
}

Response

{
  "data": {
    "id": "1a034055-6485-11ea-a338-a7395da450f1",
    "relationship_type": "zen_users",
    "source": "fa6dec91-6484-11ea-a338-6d0d189da5e0",
    "target": "fc7925e3-6484-11ea-a338-19eb2b9d27d1",
    "created_at": "2019-03-12T17:15:41.807Z"
  }
}

See Show Relationship Record by ID in the Sunshine API docs for more info.

By Type input object

Name Type Required Comment
by string yes Must be "type".
type string yes A string representing a relationship type key.
Example
{
  "type": "READ_RELATIONSHIP_RECORD",
  "key": "example_read_relationship_record_by_type",
  "description": "Example for READ_RELATIONSHIP_RECORD",
  "input": {
    "by": "type",
    "type": "zen_users"
  }
}

Response

{
  "data": [
    {
      "id": "6ea29370-a224-11e7-b1f0-191589292d4f",
      "relationship_type": "zen_users",
      "source": "e5f3f5b2-536a-4f1d-bca2-985c454362bb",
      "target": "zen:user:10002",
      "created_at": "2019-01-01T10:20:30Z"
    },
    {
      "id": "890dfe2f-a223-11e7-b1f0-4316e017a51a",
      "relationship_type": "zen_users",
      "source": "e5f3f5b2-536a-4f1d-bca2-985c454362bb",
      "target": "zen:user:10002",
      "created_at": "2019-01-01T10:20:35Z"
    }
  ],
  "links": {
    "previous": null,
    "next": null
  }
}

See List Relationship Records By Type in the Sunshine API docs for more info. Note that the pagination options are not supported here.

By Object Record

By Object Record input object

Name Type Required Comment
by string yes Must be "object_record".
type string yes A string representing a relationship type key.
object_id string yes A string representing a custom object ID.
Example
{
  "type": "READ_RELATIONSHIP_RECORD",
  "key": "example_read_relationship_record_by_object_record",
  "description": "Example for READ_RELATIONSHIP_RECORD",
  "input": {
    "by": "object_record",
    "type": "user_relationship",
    "object_id": "890dfe2f-a223-11e7-b1f0-4316e017a51a"
  }
}

Response

{
  "data": [
    {
      "id": "eae75774-18a6-448f-bca7-dda5c11bb125",
      "target": "f2771449-861e-43f0-8936-e16c3bd492d2",
      "ref": "/api/sunshine/objects/records/f2771449-861e-43f0-8936-e16c3bd492d2"
    },
    {
      "id": "517e916a-7099-11e7-8cf7-a6006ad3dba0",
      "target": "849294839",
      "ref": "/api/v2/users/849294839"
    }
  ],
  "links": {
    "previous": null,
    "next": null
  }
}

See List Relationship Records By Object Record in the Sunshine API docs for more info. Note that the pagination options are not supported here.

Delete a Sunshine Relationship Record

To delete a Sunshine relationship record, the input object must contain the id field. The value of id field is the relationship record ID:

{
  "type": "DELETE_RELATIONSHIP_RECORD",
  "key": "delete_relationship_record",
  "input": {
    "id": "relationship_record_id_1"
  }
}

Create a Sunshine Profile

This task will create or update a Sunshine profile.

JSON Format
Name Type Required Comment
input object yes Contains fields necessary for the task. There are many ways to read a Sunshine profile. See the respective descriptions:
key string yes A name given to the task. Note the key must be unique in the context of the entire workflow.
type string yes The type of task to execute. Must be "CREATE_SUNSHINE_PROFILE".
description string no A short description of your task for you and your team to reference.
optional boolean no Defaults to false. A boolean value can be set for any task in the workflow. If set to true, the task failure will not interrupt the workflow execution.

By Sunshine profile input object

Name Type Required Comment
by string yes Must be "sunshine_profile".
identifier_query string yes Creates a reference to the profile. See identifier queries for more information.
profile object yes An object containing the profile attributes. See Anatomy of a Sunshine profile for details.
Example
{
  "type": "CREATE_SUNSHINE_PROFILE",
  "key": "create_sunshine_profile",
  "input": {
    "by": "sunshine_profile",
    "identifier_query": "google:customer:email:[email protected]",
    "profile": {
      "identifiers": [
        {
          "type": "email",
          "value": "[email protected]"
        },
        {
          "type": "phone_number",
          "value": "+5559995555"
        }
      ],
      "attributes": {
        "membership_tier": "gold",
        "user_type": "administrator"
      }
    }
  }
}

See Create or update profile by identifier in the Sunshine API docs for more info.

By Sunshine profile ID input object

Name Type Required Comment
by string yes Must be "sunshine_profile_id".
sunshine_profile_id string yes A Sunshine Profile ID
profile object yes An object containing the profile attributes. See Anatomy of a Sunshine profile for details.
Example
{
  "type": "CREATE_SUNSHINE_PROFILE",
  "key": "create_sunshine_profile",
  "input": {
    "by": "sunshine_profile",
    "sunshine_profile_id": "01E7GX8RQKA5JPS4YFKSPX65S6",
    "profile": {
      "identifiers": [
        {
          "type": "email",
          "value": "[email protected]"
        },
        {
          "type": "phone_number",
          "value": "+5559995555"
        }
      ],
      "attributes": {
        "membership_tier": "gold",
        "user_type": "administrator"
      }
    }
  }
}

See Update profile by profile ID in the Sunshine API docs for more info.

By user ID input object

Name Type Required Comment
by string yes Must be "user_id".
user_id string yes A Zendesk user ID
identifier_query string yes Creates a reference to the profile. See identifier queries for more information.
profile object yes An object containing the profile attributes. See Anatomy of a Sunshine profile for details.
Example
{
  "type": "CREATE_SUNSHINE_PROFILE",
  "key": "create_sunshine_profile",
  "input": {
    "by": "user_id",
    "user_id": "54198131",
    "identifier_query": "google:customer:email:[email protected]",
    "profile": {
      "identifiers": [
        {
          "type": "email",
          "value": "[email protected]"
        },
        {
          "type": "phone_number",
          "value": "+5559995555"
        }
      ],
      "attributes": {
        "membership_tier": "gold",
        "user_type": "administrator"
      }
    }
  }
}

See Create or update profile by user ID in the Sunshine API docs for more info.

Update a Sunshine Profile

This task will create or update a Sunshine profile.

JSON Format
Name Type Required Comment
input object yes Contains fields necessary for the task. There are many ways to read a Sunshine profile. See the respective descriptions:
key string yes A name given to the task. Note the key must be unique in the context of the entire workflow.
type string yes The type of task to execute. Must be "UPDATE_SUNSHINE_PROFILE".
description string no A short description of your task for you and your team to reference.
optional boolean no Defaults to false. A boolean value can be set for any task in the workflow. If set to true, the task failure will not interrupt the workflow execution.

By Sunshine profile input object

Name Type Required Comment
by string yes Must be "sunshine_profile".
identifier_query string yes Creates a reference to the profile. See identifier queries for more information.
profile object yes An object containing the profile attributes. See Anatomy of a Sunshine profile for details.
patch boolean no Default value is false. A boolean specifying if this will be a PUT or PATCH update
Example
{
  "type": "UPDATE_SUNSHINE_PROFILE",
  "key": "update_sunshine_profile",
  "input": {
    "by": "sunshine_profile",
    "identifier_query": "google:customer:email:[email protected]",
    "profile": {
      "identifiers": [
        {
          "type": "email",
          "value": "[email protected]"
        },
        {
          "type": "phone_number",
          "value": "+5559995555"
        }
      ],
      "attributes": {
        "membership_tier": "gold",
        "user_type": "administrator"
      }
    }
  }
}

See Create or update profile by identifier in the Sunshine API docs for more info.

By Sunshine profile ID input object

Name Type Required Comment
by string yes Must be "sunshine_profile_id".
sunshine_profile_id string yes A Sunshine Profile ID
profile object yes An object containing the profile attributes. See Anatomy of a Sunshine profile for details.
patch boolean no Default value is false. A boolean specifying if this will be a PUT or PATCH update
Example
{
  "type": "UPDATE_SUNSHINE_PROFILE",
  "key": "update_sunshine_profile",
  "input": {
    "by": "sunshine_profile",
    "sunshine_profile_id": "01E7GX8RQKA5JPS4YFKSPX65S6",
    "profile": {
      "identifiers": [
        {
          "type": "email",
          "value": "[email protected]"
        },
        {
          "type": "phone_number",
          "value": "+5559995555"
        }
      ],
      "attributes": {
        "membership_tier": "gold",
        "user_type": "administrator"
      }
    }
  }
}

See Update profile by profile ID in the Sunshine API docs for more info.

By user ID input object

Name Type Required Comment
by string yes Must be "user_id".
user_id string yes A Zendesk user ID
identifier_query string yes Creates a reference to the profile. See identifier queries for more information.
profile object yes An object containing the profile attributes. See Anatomy of a Sunshine profile for details.
Example
{
  "type": "UPDATE_SUNSHINE_PROFILE",
  "key": "update_sunshine_profile",
  "input": {
    "by": "user_id",
    "user_id": "54198131",
    "identifier_query": "google:customer:email:[email protected]",
    "profile": {
      "identifiers": [
        {
          "type": "email",
          "value": "[email protected]"
        },
        {
          "type": "phone_number",
          "value": "+5559995555"
        }
      ],
      "attributes": {
        "membership_tier": "gold",
        "user_type": "administrator"
      }
    }
  }
}

See Create or update profile by user ID in the Sunshine API docs for more info.

Read a Sunshine Profile

JSON Format
Name Type Required Comment
input object yes Contains fields necessary for the task. There are many ways to read a Sunshine profile. See the respective descriptions:
key string yes A name given to the task. Note the key must be unique in the context of the entire workflow.
type string yes The type of task to execute. Must be "READ_SUNSHINE_PROFILE".
description string no A short description of your task for you and your team to reference.
optional boolean no Defaults to false. A boolean value can be set for any task in the workflow. If set to true, the task failure will not interrupt the workflow execution.

By Sunshine profile input object

Name Type Required Comment
by string yes Must be "sunshine_profile".
identifier_query string yes Creates a reference to the profile. See identifier queries for more information.
Example
{
  "name": "Read Sunshine Profile Workflow",
  "description": "a description",
  "tasks": [
    {
      "type": "READ_SUNSHINE_PROFILE",
      "key": "read_sunshine_profile",
      "input": {
        "by": "sunshine_profile",
        "identifier_query": "google:customer:email:[email protected]"
      }
    }
  ]
}

Response

{
   "profile": {
      "updated_at":"2020-03-23T16:54:12Z",
      "user_id":"54198131",
      "identifiers":[
         {
            "type":"email",
            "value":"[email protected]"
         },
        {
          "type": "phone_number",
          "value": "+5559995555"
        }
      ],
      "name":"sunshine_user",
      "created_at":"2020-03-23T16:54:12Z",
      "attributes":{
        "membership_tier": "gold",
        "user_type": "administrator"
      },
      "id":"01E7GX8RQKA5JPS4YFKSPX65S6",
      "source":"google",
      "type":"customer"
   }
}

See Get profile by identifier in the Sunshine API docs for more info.

By Sunshine profile ID input object

Name Type Required Comment
by string yes Must be "sunshine_profile_id".
sunshine_profile_id string yes A Sunshine Profile ID
Example
{
  "name": "Read Sunshine Profile Workflow",
  "description": "a description",
  "tasks": [
    {
      "type": "READ_SUNSHINE_PROFILE",
      "key": "read_sunshine_profile",
      "input": {
        "by": "sunshine_profile",
        "sunshine_profile_id": "01E7GX8RQKA5JPS4YFKSPX65S6"
      }
    }
  ]
}

Response

{
   "profile": {
      "updated_at":"2020-03-23T16:54:12Z",
      "user_id":"54198131",
      "identifiers":[
         {
            "type":"email",
            "value":"[email protected]"
         },
        {
          "type": "phone_number",
          "value": "+5559995555"
        }
      ],
      "name":"sunshine_user",
      "created_at":"2020-03-23T16:54:12Z",
      "attributes":{
        "membership_tier": "gold",
        "user_type": "administrator"
      },
      "id":"01E7GX8RQKA5JPS4YFKSPX65S6",
      "source":"google",
      "type":"customer"
   }
}

See Get profile by profile ID in the Sunshine API docs for more info.

By user ID input object

Name Type Required Comment
by string yes Must be "user_id".
user_id string yes A Zendesk user ID
Example
{
  "name": "Read Sunshine Profile Workflow",
  "description": "a description",
  "tasks": [
    {
      "type": "READ_SUNSHINE_PROFILE",
      "key": "read_sunshine_profile",
      "input": {
        "by": "user_id",
        "user_id": "54198131"
      }
    }
  ]
}

Response

{
  "profile": [
    {
      "attributes": null,
      "created_at": "2020-02-03T01:37:16Z",
      "id": "fc650a2c-463a-11ea-b77f-2e728ce88125",
      "identifiers": [
        {
          "type": "email",
          "value": "[email protected]"
        },
        {
          "type": "phone_number",
          "value": "+612345678"
        }
      ],
      "membership": "gold",
      "name": "Jane Smith",
      "source": "company",
      "type": "contact",
      "updated_at": "2020-02-03T01:37:16Z",
      "user_id": 54198131
    }
  ]
}

See Get profiles by user ID in the Sunshine API docs for more info.

Create a Sunshine Event

JSON Format
Name Type Required Comment
input object yes Contains fields necessary for the task. There are many ways to read a Sunshine profile. See the respective descriptions:
key string yes A name given to the task. Note the key must be unique in the context of the entire workflow.
type string yes The type of task to execute. Must be "CREATE_SUNSHINE_EVENT".
description string no A short description of your task for you and your team to reference.
optional boolean no Defaults to false. A boolean value can be set for any task in the workflow. If set to true, the task failure will not interrupt the workflow execution.

By Sunshine profile input object

Name Type Required Comment
by string yes Must be "sunshine_profile".
event object yes Object containing attributes of the event. See Anatomy of a Sunshine event for field details.
profile object yes Object containing attributes of the Sunshine profile. See Anatomy of a Sunshine profile for field details.
Example
{
  "type": "CREATE_SUNSHINE_EVENT",
  "key": "create_sunshine_event",
  "input": {
    "by": "sunshine_profile",
    "event": {
      "source": "amazon",
      "type": "customer_purchase",
      "properties": {
        "purchase_date": "2020-03-23"
      }
    },
    "profile": {
      "source": "amazon",
      "type": "customer",
      "identifiers": [
        {
          "type":"email",
          "value":"[email protected]"
        }
      ]
    }
  }
}

See Track event against a Sunshine profile in the Sunshine API docs for more info.

By Sunshine profile ID input object

Name Type Required Comment
by string yes Must be "sunshine_profile_id".
sunshine_profile_id string yes A Sunshine profile ID
event object yes Object containing attributes of the event. See Anatomy of a Sunshine event for field details.
Example
{
  "type": "CREATE_SUNSHINE_EVENT",
  "key": "create_sunshine_event",
  "input": {
    "by": "sunshine_profile_id",
    "sunshine_profile_id": "01E7GX8RQKA5JPS4YFKSPX65S6",
    "event": {
      "source": "amazon",
      "type": "customer_purchase",
      "properties": {
        "purchase_date": "2020-03-23"
      }
    }
  }
}

See Track event against a Sunshine profile using profile_id in the Sunshine API docs for more info.

By user ID input object

Name Type Required Comment
by string yes Must be "user_id".
user_id string yes A Zendesk user ID
event object yes Object containing attributes of the event. See Anatomy of a Sunshine event for field details.
profile object yes Object containing attributes of the Sunshine profile. See Anatomy of a Sunshine profile for field details.
Example
{
  "type": "CREATE_SUNSHINE_EVENT",
  "key": "create_sunshine_event",
  "input": {
    "by": "user_id",
    "user_id": "54198131",
    "event": {
      "source": "amazon",
      "type": "customer_purchase",
      "properties": {
        "purchase_date": "2020-03-23"
      }
    },
    "profile": {
      "source": "amazon",
      "type": "customer",
      "identifiers": [
        {
          "type":"email",
          "value":"[email protected]"
        }
      ]
    }
  }
}

See Track event against Zendesk user and given profile in the Sunshine API docs for more info.

Read Sunshine Events

Name Type Required Comment
input object yes Contains fields necessary for the task. There are many ways to read a Sunshine profile. See the respective descriptions:
key string yes A name given to the task. Note the key must be unique in the context of the entire workflow.
type string yes The type of task to execute. Must be "READ_SUNSHINE_EVENTS".
description string no A short description of your task for you and your team to reference.
optional boolean no Defaults to false. A boolean value can be set for any task in the workflow. If set to true, the task failure will not interrupt the workflow execution.

By Sunshine profile input object

Name Type Required Comment
by string yes Must be "sunshine_profile".
identifier_query string yes Creates a reference to the profile. See identifier queries for more information.
Example
{
  "type": "READ_SUNSHINE_EVENTS",
  "key": "read_sunshine_events",
  "input": {
    "by": "sunshine_profile",
    "identifier_query": "google:customer:email:[email protected]"
  }
}

See Get events by Sunshine profile in the Sunshine API docs for more info.

By Sunshine profile ID input object

Name Type Required Comment
by string yes Must be "sunshine_profile_id".
sunshine_profile_id string yes A Sunshine Profile ID
Example
{
  "type": "READ_SUNSHINE_EVENTS",
  "key": "read_sunshine_events",
  "input": {
    "by": "sunshine_profile_id",
    "sunshine_profile_id": "01E7GX8RQKA5JPS4YFKSPX65S6"
  }
}

See Get events by Sunshine profile ID in the Sunshine API docs for more info.

By user ID input object

Name Type Required Comment
by string yes Must be "user_id".
user_id string yes A Zendesk user ID
Example
{
  "type": "READ_SUNSHINE_EVENTS",
  "key": "read_sunshine_events",
  "input": {
    "by": "user_id",
    "user_id": "54198131"
  }
}

See Get Zendesk user events in the Sunshine API docs for more info.

Response

{
   "events": [
      {
         "received_at": "2020-03-20T21:52:02.223206696Z",
         "created_at": "2020-03-20T21:52:02.223205104Z",
         "id": "5e753b02676bf3000165555",
         "source": "amazon",
         "type": "customer_purchase",
         "properties": {
            "purchase_date": "2020-03-23"
         }
      }
   ],
   "links": [
      {
         "next": ""
      }
   ]
}