Page tree
Skip to end of metadata
Go to start of metadata

Channel web hooks allows to post any content to a channel or create cases in channel. Channel web hooks are created in channel properties.

Creating a New Web Hook

To create a new web hook please follow these steps;

  • Open channel that you want to create a web hook
  • Select "Edit" from channel menu
  • Switch to "Web Hooks" tabs and click to "Add New" button
  • Web hook Url is automatically generated, enter the purpose of channel
  • Click "Copy" button on next to Url field to copy Url to clipboard.
  • Click Ok to save changes.

Posting Channel Activity

After web hook is created you can post JSON data to create a new activity on channel. Web hook URL contains all the required information and does not need any authentication.

Posting Basic Message

POST /hooks/channels/f923d83a-3350-42d0-b9cb-620032730294/8459b574-62ea-4ea7-bbae-a132fbfee5df
Host: my.emakin.com
Content-Type: application/json

{
	"text" : "my message"
}

Posting Message with Attachments

As another example you can post following JSON to send a message with attachments. 

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 just posting a message. Id field must be unique for channel or otherwise web hook ignores message and returns already reported.

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"
    }]
}

JSON with "id" property automatically creates a new case and attaches the message to the case.

Updating a Case

Web hooks also supports to receive notifications about previously posted messages.

To post a new update message to an existing case, JSON data must contain a "references" property that contains the previously reported message id.

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"
    }]
}

JSON with "references" automatically appends a new message to an existing case as an update message.