Webhooks

Settings

You can enable Webhooks on TalkPlus Dashboard as follows:

  • Enable Webhook feature

  • Enter webhook handler endpoint

  • Select events that will trigger webhook

Endpoint

  • Endpoint must be able to handle HTTP POST request

  • Endpoint must be able to handle JSON format

If endpoint fails to respond, TalkPlus will re-attempt once after 5 seconds..

TalkPlus HTTP POST webhook will contain the following headers:

User-Agent

TalkPlus

content-type

application/json

x-talkplus-signature

payload is signed with your app API key using SHA-256 and then encoded to Base64

Verification

To Verify that the request to your endpoint came from TalkPlus server, compare x-talkplus-signature header value against the hash of response body.

responseBody := "{\"event\":\"channel_added\",\"appId\":\"34f633c9-b012-4ca9-b453-2a4a460f464a\",\"channel\":{\"id\":\"webhook_test\",\"name\":\"webhook_test\",\"imageUrl\":\"\",\"data\":{\"test\":\"1\"},\"ownerId\":\"test1\",\"type\":\"public\",\"category\":\"categoryA\",\"subcategory\":\"subcategoryB\",\"privateTag\":\"\",\"invitationCode\":\"\",\"isFrozen\":false,\"memberCount\":1,\"maxMemberCount\":100,\"hideMessagesBeforeJoin\":false,\"members\":[{\"id\":\"test1\",\"username\":\"test1\",\"profileImageUrl\":\"\",\"disablePushNotification\":false,\"data\":{\"test\":\"1\"},\"updatedAt\":1699606163973,\"createdAt\":1697797296688,\"memberInfo\":{},\"lastReadAt\":0,\"lastSentAt\":0}],\"bannedUsers\":[],\"lastSentAt\":1699606164578,\"updatedAt\":0,\"createdAt\":1699606164578,\"mutedUsers\":[],\"pushNotificationDisabled\":false,\"pushNotificationSoundAOS\":\"\",\"pushNotificationSoundIOS\":\"\",\"privateData\":null,\"unreadCount\":0,\"lastReadAt\":0,\"lastMessage\":null}}"
apiKey := "92935b03e231483fc2cf75d9020f7e492c8fd9c7481eb4c79620ace7fe207d81"
signatureFromHeader := "i7a/Z+7iS1P6kNpnmw6P0ZSmq83LGnrtacwaffTvIdo="

hash := hmac.New(sha256.New, []byte(apiKey))
hash.Write([]byte(responseBody))
computedSignature := base64.StdEncoding.EncodeToString(hash.Sum(nil))

fmt.Printf("signatures match: %v\n", signatureFromHeader == computedSignature)

Webhook Events

Event

Trigger

message

message sent

message_deleted

message deleted

reaction_added

reaction added to a message

reaction_deleted

reaction deleted from a message

channel_added

channel created

channel_changed

channel updated

channel_removed

channel deleted

member_added

member joined channel

member_left

member left channel

member_muted

member muted in channel

member_unmuted

member unmuted in channel

member_banned

user banned from channel

member_unbanned

user unbanned from channel

user_blocked

user blocked

user_unblocked

user unblocked

Webhook Event Payloads

message

{
    "event": "message",
    "appId": "YOUR_APP_ID",
    "channel":
    {
        "id": "YOUR_CHANNEL_ID",
        "name": "YOUR_CHANNEL_NAME",
        "ownerId": "user123",
        "type": "public",
        "imageUrl": "image url",
        "invitationCode": "",
        "isFrozen": false,
        "hideMessagesBeforeJoin": false,
        "category": "",
        "subcategory": "",
        "memberCount": 1,
        "maxMemberCount": 100,
        "data": {
              "someMetaKey1": "someMetaValue1",
              "someMetaKey2": "someMetaValue2"
        },
        "members":
        [
            {
                "id": "user123",
                "username": "user123",
                "profileImageUrl": "http://cnd.test.com/123.jpg",
                "updatedAt": 1603184094285,
                "createdAt": 1603184094285,
                "lastReadAt": 0,
                "lastSentAt": 1603244275376
            }
        ],
        "mutedUsers": [],
        "bannedUsers": [],
        "updatedAt": 0,
        "createdAt": 0,
        "unreadCount": 0,
        "lastReadAt": 0,
        "lastMessage":
        {
            "id": "sdf2l5s9j",
            "channelId": "YOUR_CHANNEL_ID",
            "userId": "user123",
            "username": "user123",
            "profileImageUrl": "http://cdn.test.com/123.jpg",
            "type": "text",
            "text": "Hello world",
            "translations": {},
            "data": {
                "customField": "customData"
            },
            "createdAt": 1583921400
        }
    },
    "sender":
    {
        "id": "user123",
        "username": "user123",
        "profileImageUrl": "http://cnd.test.com/123.jpg",
        "updatedAt": 1583924400,
        "createdAt": 1583921400
    },
    "message":
    {
        "id": "sdf2l5s9j",
        "channelId": "YOUR_CHANNEL_ID",
        "userId": "user123",
        "username": "user123",
        "profileImageUrl": "http://cdn.test.com/123.jpg",
        "type": "text",
        "text": "Hello world",
        "translations": {},
        "data":
        {
            "customField": "customData"
        },
        "createdAt": 1583921400
    }
}

message_deleted

{
    "event": "message_deleted",
    "appId": "YOUR_APP_ID",
    "channel":
    {
        "id": "YOUR_CHANNEL_ID",
        "name": "YOUR_CHANNEL_NAME",
        "ownerId": "user123",
        "type": "public",
        "invitationCode": "",
        "isFrozen": false,
        "hideMessagesBeforeJoin": false,
        "category": "",
        "subcategory": "",
        "memberCount": 1,
        "maxMemberCount": 100,
        "data": {
              "someMetaKey1": "someMetaValue1",
              "someMetaKey2": "someMetaValue2"
        },
        "members":
        [
            {
                "id": "user123",
                "username": "user123",
                "profileImageUrl": "http://cnd.test.com/123.jpg",
                "updatedAt": 1603184094285,
                "createdAt": 1603184094285,
                "lastReadAt": 0,
                "lastSentAt": 1603244275376
            }
        ],
        "mutedUsers": [],
        "bannedUsers": [],
        "updatedAt": 0,
        "createdAt": 0,
        "unreadCount": 0,
        "lastReadAt": 0,
        "lastMessage":
        {
            "id": "sdf2l5s9j",
            "channelId": "YOUR_CHANNEL_ID",
            "userId": "user123",
            "username": "user123",
            "profileImageUrl": "http://cdn.test.com/123.jpg",
            "type": "text",
            "text": "Hello world",
            "translations": {},
            "data":
            {
                "customField": "customData"
            },
            "createdAt": 1583921400
        }
    },
    "sender": // might be empty
    {
        "id": "user123",
        "username": "user123",
        "profileImageUrl": "http://cnd.test.com/123.jpg",
        "updatedAt": 1583924400,
        "createdAt": 1583921400
    },
    "message":
    {
        "id": "sdf2l5s9j",
        "channelId": "YOUR_CHANNEL_ID",
        "userId": "user123",
        "username": "user123",
        "profileImageUrl": "http://cdn.test.com/123.jpg",
        "type": "text",
        "text": "Hello world",
        "translations": {},
        "data":
        {
            "customField": "customData"
        },
        "createdAt": 1583921400
    }
}

reaction_added

{
    "event": "reaction_added",
    "appId": "YOUR_APP_ID",
    "channel":
    {
        "id": "YOUR_CHANNEL_ID",
        "name": "YOUR_CHANNEL_NAME",
        "ownerId": "user123",
        "type": "public",
        "invitationCode": "",
        "isFrozen": false,
        "hideMessagesBeforeJoin": false,
        "category": "",
        "subcategory": "",
        "memberCount": 1,
        "maxMemberCount": 100,
        "data": {
              "someMetaKey1": "someMetaValue1",
              "someMetaKey2": "someMetaValue2"
        },
        "members":
        [
            {
                "id": "user123",
                "username": "user123",
                "profileImageUrl": "http://cnd.test.com/123.jpg",
                "updatedAt": 1603184094285,
                "createdAt": 1603184094285,
                "lastReadAt": 0,
                "lastSentAt": 1603244275376
            }
        ],
        "mutedUsers": [],
        "bannedUsers": [],
        "updatedAt": 0,
        "createdAt": 0,
        "unreadCount": 0,
        "lastReadAt": 0,
        "lastMessage":
        {
            "id": "sdf2l5s9j",
            "channelId": "YOUR_CHANNEL_ID",
            "userId": "user123",
            "username": "user123",
            "profileImageUrl": "http://cdn.test.com/123.jpg",
            "type": "text",
            "text": "Hello world",
            "translations": {},
            "data":
            {
                "customField": "customData"
            },
            "createdAt": 1583921400
        }
    },
    "user":
    {
        "id": "user123",
        "username": "user123",
        "profileImageUrl": "http://cnd.test.com/123.jpg",
        "updatedAt": 1583924400,
        "createdAt": 1583921400
    },
    "message":
    {
        "id": "sdf2l5s9j",
        "channelId": "YOUR_CHANNEL_ID",
        "userId": "user123",
        "username": "user123",
        "profileImageUrl": "http://cdn.test.com/123.jpg",
        "type": "text",
        "text": "Hello world",
        "translations": {},
        "data":
        {
            "customField": "customData"
        },
        "reactions": {
            "happy": "user123"
        },
        "createdAt": 1583921400
    },
    "reaction": "happy"
}

reaction_deleted

{
    "event": "reaction_deleted",
    "appId": "YOUR_APP_ID",
    "channel":
    {
        "id": "YOUR_CHANNEL_ID",
        "name": "YOUR_CHANNEL_NAME",
        "ownerId": "user123",
        "type": "public",
        "invitationCode": "",
        "isFrozen": false,
        "hideMessagesBeforeJoin": false,
        "category": "",
        "subcategory": "",
        "memberCount": 1,
        "maxMemberCount": 100,
        "members":
        [
            {
                "id": "user123",
                "username": "user123",
                "profileImageUrl": "http://cnd.test.com/123.jpg",
                "updatedAt": 1603184094285,
                "createdAt": 1603184094285,
                "lastReadAt": 0,
                "lastSentAt": 1603244275376
            }
        ],
        "mutedUsers": [],
        "bannedUsers": [],
        "updatedAt": 0,
        "createdAt": 0,
        "unreadCount": 0,
        "lastReadAt": 0,
        "lastMessage":
        {
            "id": "sdf2l5s9j",
            "channelId": "YOUR_CHANNEL_ID",
            "userId": "user123",
            "username": "user123",
            "profileImageUrl": "http://cdn.test.com/123.jpg",
            "type": "text",
            "text": "Hello world",
            "translations": {},
            "data":
            {
                "customField": "customData"
            },
            "createdAt": 1583921400
        }
    },
    "user":
    {
        "id": "user123",
        "username": "user123",
        "profileImageUrl": "http://cnd.test.com/123.jpg",
        "updatedAt": 1583924400,
        "createdAt": 1583921400
    },
    "message":
    {
        "id": "sdf2l5s9j",
        "channelId": "YOUR_CHANNEL_ID",
        "userId": "user123",
        "username": "user123",
        "profileImageUrl": "http://cdn.test.com/123.jpg",
        "type": "text",
        "text": "Hello world",
        "translations": {},
        "data":
        {
            "customField": "customData"
        },
        "reactions": {
            "happy": "user123"
        },
        "createdAt": 1583921400
    },
    "reaction": "sad"
}

channel_added

{
  "event": "channel_added",
  "appId": "YOUR_APP_ID",
  "channel": {
    "id": "YOUR_CHANNEL_ID",
    "name": "YOUR_CHANNEL_NAME",
    "ownerId": "user123",
    "type": "public",
    "invitationCode": "",
    "isFrozen": false,
    "hideMessagesBeforeJoin": false,
    "category": "",
    "subcategory": "",
    "memberCount": 1,
    "maxMemberCount": 100,
    "members": [
      {
        "id": "user123",
        "username": "user123",
        "profileImageUrl": "http://cnd.test.com/123.jpg",
        "updatedAt": 1603184094285,
        "createdAt": 1603184094285,
        "lastReadAt": 0,
        "lastSentAt": 1603244275376
      }
    ],
    "mutedUsers": [],
    "bannedUsers": [],
    "updatedAt": 0,
    "createdAt": 0,
    "unreadCount": 0,
    "lastReadAt": 0,
    "lastMessage": null
  }
}

channel_changed

{
  "event": "channel_changed",
  "appId": "YOUR_APP_ID",
  "channel": {
    "id": "YOUR_CHANNEL_ID",
    "name": "YOUR_CHANNEL_NAME",
    "ownerId": "user123",
    "type": "public",
    "invitationCode": "",
    "isFrozen": false,
    "hideMessagesBeforeJoin": false,
    "category": "",
    "subcategory": "",
    "memberCount": 1,
    "maxMemberCount": 100,
    "members": [
      {
        "id": "user123",
        "username": "user123",
        "profileImageUrl": "http://cnd.test.com/123.jpg",
        "updatedAt": 1603184094285,
        "createdAt": 1603184094285,
        "lastReadAt": 0,
        "lastSentAt": 1603244275376
      }
    ],
    "mutedUsers": [],
    "bannedUsers": [],
    "updatedAt": 0,
    "createdAt": 0,
    "unreadCount": 0,
    "lastReadAt": 0,
    "lastMessage": null // null if there's no message in channel
  }
}

channel_removed

{
  "event": "channel_removed",
  "appId": "YOUR_APP_ID",
  "channel": {
    "id": "YOUR_CHANNEL_ID",
    "name": "YOUR_CHANNEL_NAME",
    "ownerId": "user123",
    "type": "public",
    "isFrozen": false,
    "hideMessagesBeforeJoin": false,
    "category": "",
    "subcategory": "",
    "memberCount": 1,
    "maxMemberCount": 100,
    "members": [
      {
        "id": "user123",
        "username": "user123",
        "profileImageUrl": "http://cnd.test.com/123.jpg",
        "updatedAt": 1603184094285,
        "createdAt": 1603184094285,
        "lastReadAt": 0,
        "lastSentAt": 1603244275376
      }
    ],
    "mutedUsers": [],
    "bannedUsers": [],
    "updatedAt": 0,
    "createdAt": 0,
    "unreadCount": 0,
    "lastReadAt": 0,
    "lastMessage": null // null if there's no message in channel
  }
}

member_added

{
  "event": "member_added",
  "appId": "YOUR_APP_ID",
  "channel": {
    "id": "YOUR_CHANNEL_ID",
    "name": "YOUR_CHANNEL_NAME",
    "ownerId": "user123",
    "type": "public",
    "invitationCode": "",
    "isFrozen": false,
    "hideMessagesBeforeJoin": false,
    "category": "",
    "subcategory": "",
    "memberCount": 1,
    "maxMemberCount": 100,
    "members": [
      {
        "id": "user123",
        "username": "user123",
        "profileImageUrl": "http://cnd.test.com/123.jpg",
        "updatedAt": 1603184094285,
        "createdAt": 1603184094285,
        "lastReadAt": 0,
        "lastSentAt": 1603244275376
      }
    ],
    "mutedUsers": [],
    "bannedUsers": [],
    "updatedAt": 0,
    "createdAt": 0,
    "unreadCount": 0,
    "lastReadAt": 0,
    "lastMessage": null // null if there's no message in channel
  },
  "users": [
    {
      "id": "user123",
      "username": "user123",
      "profileImageUrl": "http://cnd.test.com/123.jpg",
      "updatedAt": 1583924400,
      "createdAt": 1583921400
    }
  ]
}

member_left

{
  "event": "member_left",
  "appId": "YOUR_APP_ID",
  "channel": {
    "id": "YOUR_CHANNEL_ID",
    "name": "YOUR_CHANNEL_NAME",
    "ownerId": "user123",
    "type": "public",
    "invitationCode": "",
    "isFrozen": false,
    "hideMessagesBeforeJoin": false,
    "category": "",
    "subcategory": "",
    "memberCount": 1,
    "maxMemberCount": 100,
    "members": [
      {
        "id": "user123",
        "username": "user123",
        "profileImageUrl": "http://cnd.test.com/123.jpg",
        "updatedAt": 1603184094285,
        "createdAt": 1603184094285,
        "lastReadAt": 0,
        "lastSentAt": 1603244275376
      }
    ],
    "mutedUsers": [],
    "bannedUsers": [],
    "updatedAt": 0,
    "createdAt": 0,
    "unreadCount": 0,
    "lastReadAt": 0,
    "lastMessage": null // null if there's no message in channel
  },
  "users": [
    {
      "id": "user456",
      "username": "user456",
      "profileImageUrl": "http://cnd.test.com/123.jpg",
      "updatedAt": 1583924400,
      "createdAt": 1583921400
    }
  ]
}

member_muted

{
  "event": "member_muted",
  "appId": "YOUR_APP_ID",
  "channel": {
    "id": "YOUR_CHANNEL_ID",
    "name": "YOUR_CHANNEL_NAME",
    "ownerId": "user123",
    "type": "public",
    "invitationCode": "",
    "isFrozen": false,
    "hideMessagesBeforeJoin": false,
    "category": "",
    "subcategory": "",
    "memberCount": 1,
    "maxMemberCount": 100,
    "data": {
      "someMetaKey1": "someMetaValue1",
      "someMetaKey2": "someMetaValue2"
    },
    "members": [
      {
        "id": "user123",
        "username": "user123",
        "profileImageUrl": "http://cnd.test.com/123.jpg",
        "muteExpiresAt": 1716873953000,
        "updatedAt": 1603184094285,
        "createdAt": 1603184094285,
        "lastReadAt": 0,
        "lastSentAt": 1603244275376
      }
    ],
    "mutedUsers": [],
    "bannedUsers": [],
    "updatedAt": 0,
    "createdAt": 0,
    "unreadCount": 0,
    "lastReadAt": 0,
    "lastMessage": null // null if there's no message in channel
  },
  "users": [
    {
      "id": "user456",
      "username": "user456",
      "profileImageUrl": "http://cnd.test.com/123.jpg",
      "updatedAt": 1583924400,
      "createdAt": 1583921400
    }
  ]
}

member_unmuted

{
  "event": "member_unmuted",
  "appId": "YOUR_APP_ID",
  "channel": {
    "id": "YOUR_CHANNEL_ID",
    "name": "YOUR_CHANNEL_NAME",
    "ownerId": "user123",
    "type": "public",
    "invitationCode": "",
    "isFrozen": false,
    "hideMessagesBeforeJoin": false,
    "category": "",
    "subcategory": "",
    "memberCount": 1,
    "maxMemberCount": 100,
    "data": {
      "someMetaKey1": "someMetaValue1",
      "someMetaKey2": "someMetaValue2"
    },
    "members": [
      {
        "id": "user123",
        "username": "user123",
        "profileImageUrl": "http://cnd.test.com/123.jpg",
        "updatedAt": 1603184094285,
        "createdAt": 1603184094285,
        "lastReadAt": 0,
        "lastSentAt": 1603244275376
      }
    ],
    "mutedUsers": [],
    "bannedUsers": [],
    "updatedAt": 0,
    "createdAt": 0,
    "unreadCount": 0,
    "lastReadAt": 0,
    "lastMessage": null // null if there's no message in channel
  },
  "users": [
    {
      "id": "user456",
      "username": "user456",
      "profileImageUrl": "http://cnd.test.com/123.jpg",
      "updatedAt": 1583924400,
      "createdAt": 1583921400
    }
  ]
}

member_banned

{
  "event": "member_banned",
  "appId": "YOUR_APP_ID",
  "channel": {
    "id": "YOUR_CHANNEL_ID",
    "name": "YOUR_CHANNEL_NAME",
    "ownerId": "user123",
    "type": "public",
    "invitationCode": "",
    "isFrozen": false,
    "hideMessagesBeforeJoin": false,
    "category": "",
    "subcategory": "",
    "memberCount": 1,
    "maxMemberCount": 100,
    "members": [
      {
        "id": "user123",
        "username": "user123",
        "profileImageUrl": "http://cnd.test.com/123.jpg",
        "updatedAt": 1603184094285,
        "createdAt": 1603184094285,
        "lastReadAt": 0,
        "lastSentAt": 1603244275376
      }
    ],
    "mutedUsers": [],
    "bannedUsers": [],
    "updatedAt": 0,
    "createdAt": 0,
    "unreadCount": 0,
    "lastReadAt": 0,
    "lastMessage": null // null if there's no message in channel
  },
  "users": [
    {
      "id": "user456",
      "username": "user456",
      "profileImageUrl": "http://cnd.test.com/123.jpg",
      "updatedAt": 1583924400,
      "createdAt": 1583921400
    }
  ]
}

member_unbanned

{
  "event": "member_unbanned",
  "appId": "YOUR_APP_ID",
  "channel": {
    "id": "YOUR_CHANNEL_ID",
    "name": "YOUR_CHANNEL_NAME",
    "ownerId": "user123",
    "type": "public",
    "invitationCode": "",
    "isFrozen": false,
    "hideMessagesBeforeJoin": false,
    "category": "",
    "subcategory": "",
    "memberCount": 1,
    "maxMemberCount": 100,
    "members": [
      {
        "id": "user123",
        "username": "user123",
        "profileImageUrl": "http://cnd.test.com/123.jpg",
        "updatedAt": 1603184094285,
        "createdAt": 1603184094285,
        "lastReadAt": 0,
        "lastSentAt": 1603244275376
      }
    ],
    "mutedUsers": [],
    "bannedUsers": [],
    "updatedAt": 0,
    "createdAt": 0,
    "unreadCount": 0,
    "lastReadAt": 0,
    "lastMessage": null // null if there's no message in channel
  },
  "users": [
    {
      "id": "user456",
      "username": "user456",