Chuyển tới nội dung chính

Create Event

Create a new event in a specified channel.

POST odata/eventDefinitions
--x-appvity-channelId: [ChannelID]
--x-appvity-teamid: [TeamID]
--Cookie: graphNodeCookie=[ID]
--data-raw: {Event-Object}

URL Endpoint

odata/eventDefinitions

Method

POST.

Parameters

Do not supply OData Filter syntax.

Request

Header

--x-appvity-channelId: [ChannelID]
--x-appvity-teamid: [TeamID]
--Cookie: graphNodeCookie=[ID]

Body

In the request body, supply a JSON representation of Event object.

{

"teamId": [TeamID],

"channelId": [ChannelID],

"entityType": [Type],

"eventName": [EventnNme],

"enable": true,

"triggerType": [Trigger],

"conditionsOps": [ConditionsOps],

"conditions": [

{

"ops": [conditionsOps],

"conditions": [ConditionObject]

}

],

"actionType": [ActionType],

"action": {[ActionObject]}

}

[conditionsOps] has two values: "and" or "or"

The [Condition Object] includes the conditions for executing the following action with the following structure:

{

"field": [FieldName],

"ops": [Ops],

"value": [Value]

}

The available entities of the [FieldName] are: "Title", "Body", "AssignTo", "Status", "Priority", "Source", "Start Date", and "Due Date". eTask supports the action type is "HTTP" and "SendMail". Each type will have a specified [ActionObject]

Response

If successful, this method returns a 200 OK response code and the event object.

Example

Request

--x-appvity-channelId: [ChannelID]
--x-appvity-teamid: [TeamID]
--Cookie: graphNodeCookie=[ID]

Body

{
"teamId": "19:15c258785b4040699180e7a8ad6c6014@thread.tacv2",
"channelId": "19:15c258785b4040699180e7a8ad6c6014@thread.tacv2",
"entityType": "task",
"eventName": "Test New Event ",
"enable": true,
"triggerType": "ITEM_CREATED",
"conditionsOps": "and",
"conditions": [
{
"ops": "and",
"conditions": [
{
"field": "status",
"ops": "Is",
"value": "Not Started"
}
]
}
],
"actionType": "SendMail",
"action": {
"sendAs": "team.etask.mail@anadea",
"to": {
"projectManager": false,
"whoCreateTask": false,
"whoAssignedTask": true,
"specificPeople": false,
"people": []
},
"cc": {
"projectManager": false,
"whoCreateTask": false,
"whoAssignedTask": false,
"specificPeople": false,
"people": []
},
"bcc": {
"projectManager": false,
"whoCreateTask": false,
"whoAssignedTask": false,
"specificPeople": false,
"people": []
}
}
}

Response

{
"@odata.context": "https://schema.appvity.com/odata/$metadata#eventDefinitions/$entity",
"@odata.editLink": "https://schema.appvity.com/odata/eventDefinitions('5f72a3404d596392f5abd604')",
"@odata.id": "https://schema.appvity.com/odata/eventDefinitions('5f72a3404d596392f5abd604')",
"entityType": "task",
"eventName": "Test New Event ",
"enable": true,
"triggerType": "ITEM_CREATED",
"conditionsOps": "and",
"conditions": [
{
"ops": "and",
"conditions": [
{
"field": "status",
"ops": "Is",
"value": "Not Started"
}
]
}
],
"actionType": "SendMail",
"action": {
"sendAs": "team.etask.mail@anadea",
"to": {
"projectManager": false,
"whoCreateTask": false,
"whoAssignedTask": true,
"specificPeople": false,
"people": []
},
"cc": {
"projectManager": false,
"whoCreateTask": false,
"whoAssignedTask": false,
"specificPeople": false,
"people": []
},
"bcc": {
"projectManager": false,
"whoCreateTask": false,
"whoAssignedTask": false,
"specificPeople": false,
"people": []
}
},
"createdAt": "2020-09-29T03:00:16.669Z",
"updatedAt": "2020-09-29T03:00:16.669Z",
"_id": "5f72a3404d596392f5abd604",
"internalId": 38
}