Webhook

Webhooks make it super easy to build on top of Qiscus chat SDK. They are user-defined callbacks. They are triggered by events. When the event occurs, the webhook will make a http(s) call to the URI it’s configured to.

On Post Message

Webhooks on post message being triggered either from Qiscus Chat SDK client side or from Server API whenever send a message.

  • On Client Post Comment, triggered when client side send a message
  • On Rest Post Comment, triggered when server API send a message

You can setup webhook in Qiscus Dashboard. Go to Setting then add your webhook.

After succeed setup webhook, and the event being triggered, you will receive payload below:

Payload :

JSON
Copy

If the chat room type is a channel (is_public_channel = true) then webhook only sends payload consist of user, room, message, not include the participants

Signature token

For security reasons, you probably want to limit requests to those coming from Qiscus. You can do by generating webhook signature token.

When your signature token is generated, Qiscus uses it to create a hash signature with each payload.

This hash signature is passed along with each request in the headers as QISCUS-SDK-SIGNATURE. The signature token is generated by SHA256. To ensure request from Qiscus, you need to validate that the hash from Qiscus matches with QISCUS-SDK-SIGNATURE. Here example on how to validate the signature token:

Go
Copy
Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard