...
Code Block |
---|
POST /hooks/channels/f923d83a-3350-42d0-b9cb-620032730294/8459b574-62ea-4ea7-bbae-a132fbfee5df Host: my.emakin.com Content-Type: application/json { "text" : "my message", "attachment" : [ { "@type": "file", "displayName": "my file", "ext": "txt", "url": "http://myserver/myfile" }, { "@type": "link", "url": "http://www.google.com", "displayName": "http://www.google.com" }] } |
Creating a New Case In Channel
When JSON data contains a "id" property web hook creates a new case instead of a just posting a message. Id field must be unique for channel or otherwise web hook ignores message and returns already reported.
Code Block |
---|
POST /hooks/channels/f923d83a-3350-42d0-b9cb-620032730294/8459b574-62ea-4ea7-bbae-a132fbfee5df
Host: my.emakin.com
Content-Type: application/json
{
"id" : "event1",
"text" : "my message",
"attachment" : [
{
"@type": "file",
"displayName": "my file",
"ext": "txt",
"url": "http://myserver/myfile"
},
{
"@type": "link",
"url": "http://www.google.com",
"displayName": "http://www.google.com"
}]
} |
Updating a Case
Web hooks also supports the receive notifications about previously posted messages.
To post a new update message to existing case, JSON data must contain a "references" property that contains the previously reported message id.
Code Block |
---|
POST /hooks/channels/f923d83a-3350-42d0-b9cb-620032730294/8459b574-62ea-4ea7-bbae-a132fbfee5df
Host: my.emakin.com
Content-Type: application/json
{
"id" : "event2",
"references" : [ "event1" ],
"text" : "my message",
"attachment" : [
{
"@type": "file",
"displayName": "my file",
"ext": "txt",
"url": "http://myserver/myfile"
},
{
"@type": "link",
"url": "http://www.google.com",
"displayName": "http://www.google.com"
}]
} |