Getting Started

Webhooks allow you to subscribe to certain events on Upstra. When an event is triggered, an HTTP POST payload is sent to the webhook's configured URL. Webhooks can serve various purposes such as creating push notifications, backup logging or even building external applications based on webhook events.

Events

Upstra does not currently support subscribing to specific events just yet. All the following events will trigger a server response in the form of an HTTP POST payload to the webhook's configured URL.

Event name

Description

message.didCreate

any time a user in your network creates a message

channel.didCreate

any time a channel is created

channel.didJoin

any time a user joins a channel

channel.didAddUsers

any time a user adds other users to a channel

Payloads

Though each event has a specific payload format with the relevant event information; they all use the same object structure with the following keys:

Header

Description

requestId

a unique identifier of the post request. You can use it to trace back to our Upstra server when there is an issue

webhookId

the subcribtion id of the webhook registered to our server.

event

an event name that triggers this POST request

data

the relevent event information that relates to the trigger event. Each event has specific payload format.

Delivery Headers

The HTTP POST payloads that are delivered to your webhook's configured URL endpoint will contain the following headers:

Header

Description

x-eko-signature

the HMAC hex digest of the response body.The HMAC hex digest is generated using the sha1 hash function and the secret as the HMAC key.

Example Delivery

POST /youurl HTTP/1.1
Host: localhost:4567
X-EKO-Signature: sha1=7d38cdd689735b008b3c702edd92eea23791c5f6
User-Agent: node-superagent/4.0.0
Content-Type: application/json
Content-Length: 442
{
"requestId": "5c01045b8350df000fdff589",
"webhookId": "5c0103408350df000fdff588",
"event": "channel.didCreate",
"data": {
"userIds": ["A"],
"channel": {
"isDistinct": false,
"type": "standard",
"metadata": {},
"tags": [],
"isMuted": false,
"lastActivity": "2018-11-30T09:35:23.816Z",
"updatedAt": "2018-11-30T09:35:23.815Z",
"createdAt": "2018-11-30T09:35:23.815Z",
"isRateLimited": false,
"rateLimitWindow": 1000,
"channelId": "testWebhook",
"memberCount": 0,
"messageCount": 0
},
"users": [
{
"displayName": "A",
"updatedAt": "2018-11-30T11:39:19.615Z",
"createdAt": "2018-11-01T09:33:57.811Z",
"userId": "A",
"roles": [],
"flagCount": 0,
"hashflag": { "bits": 0, "hashes": 0, "hash": [] }
}
]
}
}