Incoming Webhooks for Pumble
With the incoming webhooks, you can easily post messages from other apps into Pumble. When you create an incoming webhook, you receive a unique URL by which you can send a JSON payload with the message text.
Creating an incoming webhook #
To create a new incoming webhook:
- Click on your Workspace name at the top left corner
- Navigate to the Workspace settings
- Select General settings from the dropdown
- Click on the Incoming Webhooks section in the sidebar
- Click on the New Webhook button at the top right corner
- Choose the channel where your webhook will post messages
- Click on the Add incoming Webhook button to complete the process
When you create your webhook, the editor opens up automatically. There, you’ll be able to customize its name, change the channel, add a descriptive label, customize the icon, and most importantly, copy or regenerate your unique URL.
The limit rate on the incoming webhooks on Pumble is one second per webhook.
Using incoming webhook to send a message #
To send a message using the incoming webhooks you just created, simply make an HTTP POST request to the unique URL you copied from the webhook editor.
The request payload should contain the text property and that text will be posted into a specified channel. Currently supported content types are:
- application/json
- application/x-www-form-urlencoded
Here is a sample curl request for posting to a channel using an incoming webhook using the application/x-www-form-urlencoded content type:
curl -X POST \ --location "https://api.pumble.com/workspaces/WORKSPACE-ID/incomingWebhooks/postMessage/WEBHOOK-CODE" \ --data-urlencode "payload={ \"text\": \"This is posted to general and comes from a bot named MyNewWebhook.\" }"
Here is a sample JSON curl request for posting to a channel using an incoming webhook:
curl -X POST \ --location
"https://api.pumble.com/workspaces/WORKSPACE-ID/incomingWebhooks/postMessage/WEBHOOK-CODE" \
-H "Content-Type: application/json" \
-d '{"payload":{"text":"This is posted to general and comes from a bot named MyNewWebhook."}}'
Rich text formatting is supported for webhook messages.
Text formatting can be done using following syntax in your JSON file:
"**text**" bold text; "*text*" italic text; "\\`text`" (code)
Users, user groups and channels can be mentioned in webhook messages.
Error handling #
If everything is set up correctly, you’ll receive an HTTP 200 status to indicate that your incoming webhook worked and the message was sent successfully. This might not always be the case, and this action can fail for numerous reasons.
Some of the errors you might encounter if your webhooks fail are:
message: Incoming webhook is disabled. code: 400700 | The Webhook was disabled by the Workspace Admin |
message: Incoming webhook is deleted. code: 400702 | The Webhook was deleted by the Workspace Admin |
message: Not found. code: 404100 | Unique URL was not found and was most likely regenerated by the workspace Admin |
message: You can not perform this operation. code: 403200 | You don’t have permission to post in the specified channel |
message: Channel is archived. code: 400440 | The channel where the webhooks is sending messages is Archived |
message: Invalid payload format. code: 400703 | Request payload is not in one of the supported formats. |