Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Step 1: Setup your callback URL

Your callback URL is an endpoint available over HTTP/HTTPS which accepts JSON payloads, e.g. You can use Flock's webhooks to send and receive messages from external services using JSON packets. An outgoing webhook sends messages from a Flock channel to an external service.

Before you create an outgoing webhook, you'll need to set up a Callback URL - an HTTP/HTTPS endpoint on your server that accepts JSON payloads. E.g. https://api.yourservice.com/callback 


Info
titleCallback URL

The messages are posted to your endpoint with the HTTP headers Content-Type: application/json; andand Accept-Encoding: gzip, deflate with the . The JSON payload is in the body. If you need help setting up your callback URL URL, contact developer support.

Step 2: Configure

...

Create an outgoing webhook

  • Navigate to the Flock Developer Dashboard at https://

...

...

Step 3: Receive messages to your endpoint

JSON packets of the following format will be posted (with HTTP POST) to the callback URL you've specified.

...

languagejs
titleJSON

...

  • .
  • Sign in with your Flock account and click Webhooks on the left.
  • Choose to Add an Outgoing Webhook.

Webhooks_Dev01.pngImage Added

  • Set the Channel where the webhook should look for messages to send to an external service.

Webhooks_DevO01.pngImage Added

  • Give the webhook a name and an icon that will be used to post replies in Flock.

Webhooks_DevO02.pngImage Added

  • Enter the Callback URL that Flock should send your messages to.

Webhooks_DevO03.pngImage Added

  • Click on Save Settings. The outgoing webhook will post JSON packets to the Callback URL in the following format
Code Block
themeEclipse
{
"id":"000025c9-0000-002a-0000-000000002fff",
   "from":"cc1ma89nnd4jm9vf@go.to/talk.to_MAC_1.0.0.147_nqKMZE",
   "to":"1937653121826658704@groups.go.to",
   "type":"message",
   "text":"Test"
}

For details about the fields check the Message object. 

...

titleVerifying Requests

...

  • ?token=<webhook-token>

...

  •  is appended to the callback URL while making the call so you can verify that the request came from Flock.

...

Replying to received messages

 You can reply to messages you receive by sending a JSON packet in your HTTP response.

This is similar to sending messages to an incoming webhook.