Targets
Targets are pointers to cloud-based applications and services such as Twitter and Twilio, as well as to HTTP and email addresses. You can use targets with triggers and automations to send a notification to the target when a ticket is created or updated. For a list of targets, see Notifying external targets.
To specify a target notification as an action for a trigger or automation, use the action's notification_target
field. The field's value is an array of two strings specifying the numeric ID of the target and the message body. Example:
{
"actions": [
{"field": "notification_target", "value": ["32322", "Ticket {{ticket.id}} has been updated."]}
]
}
For more information, see Triggers or Automations.
JSON Format
Targets are represented as JSON objects with the following properties:
Name | Type | Read-only | Mandatory | Description |
---|---|---|---|---|
active | boolean | false | false | Whether or not the target is activated |
created_at | string | true | false | The time the target was created |
id | integer | true | false | Automatically assigned when created |
title | string | false | true | A name for the target |
type | string | false | true | A pre-defined target, such as "basecamp_target". See the additional attributes for the type that follow |
Besides the common fields, the target may have extra properties depending on its type.
"basecamp_target" has the following additional attributes:
Name | Type | Mandatory | Comment |
---|---|---|---|
target_url | string | yes | The URL of your Basecamp account, including protocol and path |
username | string | The 37Signals username of the account you use to log in to Basecamp | |
password | string | The 37Signals password for the Basecamp account (only writable) | |
token | string | yes | Get the API token from My info > Show your tokens > Token for feed readers or the Basecamp API in your Basecamp account |
project_id | string | yes | The ID of the project in Basecamp where updates should be pushed |
resource | string | yes | "todo" or "message" |
message_id | string | Can be filled if it is a "todo" resource | |
todo_list_id | string | Can be filled if it is a "message" resource |
"campfire_target" has the following additional attributes:
Name | Type | Mandatory | Comment |
---|---|---|---|
subdomain | string | yes | |
ssl | boolean | ||
room | string | yes | |
token | string | yes | |
preserve_format | boolean |
"clickatell_target" has the following additional attributes:
Name | Type | Mandatory | Comment |
---|---|---|---|
target_url | string | Read-only | |
method | string | Read-only | |
attribute | string | Read-only | |
username | string | yes | |
password | string | yes | only writable |
api_id | string | yes | |
to | string | yes | |
from | string | ||
us_small_business_account | string | Possible values: "0" or "1" for false or true |
"email_target" has the following additional attributes:
Name | Type | Mandatory | Comment |
---|---|---|---|
string | yes | ||
subject | string | yes |
"flowdock_target" has the following additional attributes:
Name | Type | Mandatory | Comment |
---|---|---|---|
api_token | string | yes |
"get_satisfaction_target" has the following additional attributes:
Name | Type | Mandatory | Comment |
---|---|---|---|
string | yes | ||
password | string | yes | only writable |
account_name | string | yes | |
target_url | string |
"jira_target" has the following additional attributes:
Name | Type | Mandatory | Comment |
---|---|---|---|
target_url | string | yes | |
username | string | yes | |
password | string | yes | only writable |
"pivotal_target" has the following additional attributes:
Name | Type | Mandatory | Comment |
---|---|---|---|
token | string | yes | |
project_id | string | yes | |
story_type | string | yes | |
story_title | string | yes | |
requested_by | string | ||
owner_by | string | ||
story_labels | string |
"twitter_target" has the following additional attributes:
Name | Type | Mandatory | Comment |
---|---|---|---|
token | string | ||
secret | string | only writable |
"url_target" has the following additional attributes:
Name | Type | Mandatory | Comment |
---|---|---|---|
target_url | string | yes | |
method | string | "get" | |
attribute | string | yes | |
username | string | ||
password | string | only writable |
"http_target" has the following additional attributes:
Name | Type | Mandatory | Comment |
---|---|---|---|
target_url | string | yes | |
method | string | yes | "get", "patch", "put", "post", or "delete" |
username | string | ||
password | string | only writable | |
content_type | string | yes | "application/json", "application/xml", or "application/x-www-form-urlencoded" |
"yammer_target" has the following additional attributes:
Name | Type | Mandatory | Comment |
---|---|---|---|
group_id | string | ||
token | string |
Example
{
"active": false,
"created_at": "2012-02-20T22:55:29Z",
"id": 88335,
"title": "basecamp target",
"type": "basecamp_target",
"url": "https://company.zendesk.com/api/v2/targets/88335.json"
}
List Targets
GET /api/v2/targets
Allowed For
- Agents
Using curl
curl https://{subdomain}.zendesk.com/api/v2/targets.json \
-v -u {email_address}:{password}
Example Response
Status 200 OK
{
"targets": [
{
"active": true,
"created_at": "2009-05-13T00:07:08Z",
"id": 211,
"title": "Fancy box",
"type": "basecamp_target"
}
]
}
Create Target
POST /api/v2/targets
Allowed For
- Admins
Using curl
curl https://{subdomain}.zendesk.com/api/v2/targets \
-H "Content-Type: application/json" -X POST \
-d '{"target": {"type": "email_target", "title": "Test Email Target", "email": "[email protected]", "subject": "Test Target"}}' \
-v -u {email_address}:{password}
Example Response
Status 201 Created
{
"target": {
"active": true,
"created_at": "2009-05-13T00:07:08Z",
"email": "[email protected]",
"subject": "Test Target",
"title": "Test Email Target",
"type": "email_target"
}
}
Show Target
GET /api/v2/targets/{target_id}
Allowed For
- Agents
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
target_id | integer | Path | true | The ID of the target |
Using curl
curl https://{subdomain}.zendesk.com/api/v2/targets/{target_id}.json \
-v -u {email_address}:{password}
Example Response
Status 200 OK
{
"target": {
"active": true,
"created_at": "2009-05-13T00:07:08Z",
"id": 211,
"title": "Fancy box",
"type": "basecamp_target"
}
}
Update Target
PUT /api/v2/targets/{target_id}
Allowed For
- Admins
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
target_id | integer | Path | true | The ID of the target |
Using curl
curl https://{subdomain}.zendesk.com/api/v2/targets/{target_id} \
-H "Content-Type: application/json" -X PUT \
-d '{"target": {"email": "[email protected]"}}' \
-v -u {email_address}:{password}
Example Response
Status 200 OK
{
"target": {
"active": true,
"created_at": "2009-05-13T00:07:08Z",
"email": "[email protected]",
"subject": "Test Target",
"title": "Test Email Target",
"type": "email_target"
}
}
Delete Target
DELETE /api/v2/targets/{target_id}
Allowed For
- Admins
Parameters
Name | Type | In | Required | Description |
---|---|---|---|---|
target_id | integer | Path | true | The ID of the target |
Using curl
curl https://{subdomain}.zendesk.com/api/v2/targets/{target_id} \
-H "Content-Type: application/json" -X DELETE \
-v -u {email_address}:{password}
Example Response
Status 204 No Content