Webhooks | Glue Guide
Overview
Webhooks allow you to send messages and create threads inside of Glue by making a simple POST to the webhook endpoint. Here is a basic example that sends a message to the group chat for the group with ID grp_2hSyORgf8VqMLg0ADIvTi9oY6Nk.
Copy
curl -s -X POST \
-H "Content-Type: application/json" \
-d '{
"target": "grp_2hSyORgf8VqMLg0ADIvTi9oY6Nk",
"text": "New bug reported!"
}' \
"https://app.gluegroups.com/webhook/wbh_123.../456..."
Create a webhook
In Glue, navigate to the Apps section of the workspace settings.
Locate Webhook in the list and click Add.
Enter a name and description, and then click Create.
After creating, you can see and copy the URL for the webhook.
Obtain a target ID
In order to send a webhook, you'll need the ID of a group or thread.
To do this, navigate to the appropriate group or thread, open the menu, and then select Copy share link.
Paste the link and then look for an identifier in the URL. Group IDs start with grp_... and thread IDs start with thr_...
If you are using the app from your browser, you can also look for these values in the URL bar. Note that at times, multiple IDs may be present depending on what you're viewing.
In this case, you can see the group ID of grp_2hSyORgf8VqMLg0ADIvTi9oY6Nk in the following URL:
Copy
https://app.gluegroups.com/grp_2hSyORgf8VqMLg0ADIvTi9oY6Nk?t=Chat
Use this value in the target field of your webhook payload.
Specify the target in the URL
If you can't control the body of the request — for example, when pasting a webhook URL into a third-party tool like an alerting, monitoring, or deployment service — you can put the target directly in the webhook URL as a query parameter:
Copy
https://app.gluegroups.com/webhook/wbh_123.../456...?target=grp_2hSyORgf8VqMLg0ADIvTi9oY6Nk
When target is included in the URL, you can leave it out of the body. The webhook will send to the thread or group identified by the query parameter.
If target is present in both the URL and the body, the value in the body wins.
This makes it easy to drop a Glue webhook URL into any "paste a webhook URL here" integration without needing to customize the request body.
Copy
curl -s -X POST \
-H "Content-Type: application/json" \
-d '{
"text": "Deploy finished!"
}' \
"https://app.gluegroups.com/webhook/wbh_123.../456...?target=grp_2hSyORgf8VqMLg0ADIvTi9oY6Nk"
Webhook payload
Here are the fields that you can send to the webhook endpoint. These fields should be sent as JSON with Content-Type application/json .
| Field | Description |
|---|---|
text |
Required. The text of the message to send. By default, this is treated as markdown. |
target |
Required, unless you specify the target as a query parameter on the webhook URL. The ID of a thread or group to send to. |
threadSubject |
If specified, a thread will be created instead of just sending a message. |
uniqueBy |
Specify a value to update the message after it is created. |
threadBy |
If specified, the webhook will send follow up messages to created threads with the same value. |
Examples
At a minimum, you must specify a target and text to send a message via a webhook.
Copy
curl -s -X POST \
-H "Content-Type: application/json" \
-d '{
"target": "thr_2hTJ4DGsxUAeEhKOyJ2PMePFL0c",
"text": "New bug reported!"
}' \
"https://app.glue.ai/webhook/wbh_123.../456..."
The additional examples below demonstrate more advanced functionality.
Example: Sending and updating a message
To send a message, simply provide a target field with a thread or group ID and a text field with the message text. Optionally, you can pass a uniqueBy value that you can use to update the message by calling the webhook again with the same value.
Copy
curl -s -X POST \
-H "Content-Type: application/json" \
-d '{
"target": "thr_2hTJ4DGsxUAeEhKOyJ2PMePFL0c",
"text": "New bug reported: [BUG154](https://example.com/BUG154)",
"uniqueBy": "BUG154"
}' \
"https://app.glue.ai/webhook/wbh_123.../456..."
To update the previously sent message, call the webhook again with the same uniqueBy value.
Copy
curl -s -X POST \
-H "Content-Type: application/json" \
-d '{
"target": "thr_2hTJ4DGsxUAeEhKOyJ2PMePFL0c",
"text": "New bug reported: [BUG154](https://example.com/BUG154) \n\nResolved by Jason",
"uniqueBy": "BUG154"
}' \
"https://app.glue.ai/webhook/wbh_123.../456..."
Example: Formatting messages
Glue uses markdown to format messages. The following features are supported:
- Text styling
- Links
- User mentions
- Inline code
- Code blocks
- Blockquotes
- Paragraphs
- Lists
1. Text Styling
Bold
To make text bold, wrap it with two asterisks (**). For example:
Copy
**This is bold text**
Italics
To italicize text, wrap it with one asterisk (*). For example:
Copy
*This is italic text*
Strikethrough
To strikethrough text, wrap it with two tildes (~~). For example:
Copy
~~This text is strikethrough~~
2. Links
To create a hyperlink, use square brackets [ ] and parentheses ( ). For example:
Copy
[Glue](/content/site-root.html)
3. Inline Code To include inline code, wrap your text with backticks (```). For example:
Copy
Here is some inline code: `print("Hello, World!")`
4. Code Blocks
For longer code snippets, use triple backticks (\) before and after your code block. You can specify the language for syntax highlighting. For example:
Copy
```python
for i in range(10):
print(i)
```
5. Blockquotes
To create a blockquote, use the greater than (>) symbol followed by a space. For example:
Copy
> This is a blockquote.
6. Paragraphs To create paragraphs, separate your text with blank lines. For example:
Copy
This is the first paragraph.
This is the second paragraph.
7. Lists
Unordered Lists
To create an unordered list, use -, *, or + followed by a space. For example:
Copy
- Item 1
- Item 2
- Subitem 1
- Subitem 2
* Item 3
+ Item 4
Ordered Lists To create an ordered list, use numbers followed by a period and a space. For example:
Copy
1. First item
2. Second item
1. Subitem 1
2. Subitem 2
3. Third item
Example: Creating threads
To create a thread instead of just sending a message, specify a threadSubject and ensure the target value is a group.
Copy
curl -s -X POST \
-H "Content-Type: application/json" \
-d '{
"target": "grp_2hSyORgf8VqMLg0ADIvTi9oY6Nk",
"threadSubject": "New crash in main.js",
"text": "ReferenceError: reference to undefined property x",
"threadBy": "BUG268",
"uniqueBy": "BUG268-starter-message"
}' \
"https://app.glue.ai/webhook/wbh_123.../456..."
Example: Attachments
To send a message with an attachment, start by uploading the attachment.
Copy
FILE="yourfile.pdf"
FILENAME=$(basename "$FILE")
CONTENT_LENGTH=$(wc -c < "$FILE" | tr -d ' ')
CONTENT_MD5=$(openssl dgst -md5 -binary "$FILE" | openssl base64)
curl -X PUT "https://api.gluegroups.com/webhook/wbh_123.../456.../attachment" \
--data-binary @"$FILE" \
-H "Content-Length: $CONTENT_LENGTH" \
-H "Content-MD5: $CONTENT_MD5" \
-H "X-File-Name: $FILENAME"
To send a message with the uploaded file attached, simply include an attachments field with an array containing the file ID you want to attach.
Copy
curl -s -X POST \
-H "Content-Type: application/json" \
-d '{
"target": "thr_2kbzWHxtQvfVEgwEdQduuxRTYG3",
"text": "New report available!",
"attachments": ["fil_2ymM4HRuRY4A7ed8OvVaUYxQ812"]
}' \
"https://api.gluegroups.com/webhook/wbh_123.../456..."