Message Widget
Embed a list of your recent TeamMessages on your own website. Perfect for displaying news, announcements, or alerts to your visitors.
Overview
The Message Widget allows you to display your team's recent messages on any external website. Use cases include:
- Displaying news or announcements on your company website
- Showing alerts on an intranet page
- Integrating message history into custom applications
Authentication
The Widget API requires a Bearer token for authentication. Create an API token in your account settings:
- Log in to your account
- Go to API Tokens
- Create a new token
- Copy the token and use it in your widget URL
Security Note
Keep your API token confidential. If you embed the widget on a public website, the token will be visible in the page source. For public-facing widgets, consider using server-side includes where the token remains on your server.
API Endpoints
| Endpoint | Description |
|---|---|
/api/v1/widget/messages/ |
Returns messages as JSON (for custom integrations) |
/api/v1/widget/embed.html |
Returns HTML fragment or full page for embedding |
Parameters
| Parameter | Required | Description | Default |
|---|---|---|---|
token |
Yes | API token for authentication | - |
tm |
Yes | Team ID (customer number) | - |
tl |
Yes* | Comma-separated teamlist IDs | - |
teamlist_email |
Yes* | Comma-separated teamlist email addresses (alternative to tl) | - |
nu |
No | Number of messages to display (max 100) | 10 |
sf |
No | Show sender name (1=yes, 0=no) | 1 |
st |
No | Show team list address (1=yes, 0=no) | 0 |
ds |
No | Include direct SMS messages (1=yes, 0=no) | 0 |
* Either tl or teamlist_email must be provided. If both are given, tl takes precedence.
Additional Parameters for HTML Embed
| Parameter | Description | Default |
|---|---|---|
fp |
Full page mode - includes HTML/HEAD/BODY tags (1=yes, 0=fragment only) | 0 |
fm |
Show full email addresses (1=yes, 0=username only) | 0 |
hl |
Show headline with team name (1=yes, 0=no) | 1 |
css |
Custom CSS URL (optional, in addition to default styles) | - |
Embedding Methods
Method 1: iFrame
The simplest method - embed the widget in an iframe:
iFrame Embed
<iframe
src="https://www.teammessage.eu/api/v1/widget/embed.html?tm=YOUR_TEAM_ID&tl=YOUR_TEAMLIST_IDS&fp=1&token=YOUR_TOKEN"
width="100%"
height="400"
frameborder="0">
</iframe>
Tip
Use fp=1 (full page mode) when embedding in an iframe. This includes the necessary HTML structure and CSS.
Method 2: JavaScript Fetch
For more control, fetch the JSON data and render it yourself:
JavaScript Integration
<div id="teammessages"></div>
<script>
fetch('https://www.teammessage.eu/api/v1/widget/messages/?tm=YOUR_TEAM_ID&tl=YOUR_TEAMLIST_IDS&token=YOUR_TOKEN')
.then(response => response.json())
.then(data => {
const container = document.getElementById('teammessages');
data.messages.forEach(msg => {
const div = document.createElement('div');
div.innerHTML = `
<p><strong>${new Date(msg.date).toLocaleString()}</strong></p>
<p>${msg.text}</p>
`;
container.appendChild(div);
});
});
</script>
Method 3: Server-Side Include (PHP)
For better security, fetch the widget on your server where the token is not exposed to visitors:
PHP Include
<?php
$token = 'YOUR_SECRET_TOKEN';
$team_id = 'YOUR_TEAM_ID';
$teamlist_ids = 'YOUR_TEAMLIST_IDS';
$url = "https://www.teammessage.eu/api/v1/widget/embed.html?" . http_build_query([
'tm' => $team_id,
'tl' => $teamlist_ids,
'nu' => 5,
'token' => $token
]);
echo file_get_contents($url);
?>
JSON Response Format
The JSON endpoint returns data in the following format:
JSON Response
{
"team_name": "Demo Team",
"messages": [
{
"date": "2026-01-18T10:30:00Z",
"from_name": "Max Mustermann",
"from_email": "max@example.de",
"team_address": "demo@tmsg.de",
"text": "This is a sample message text.",
"sms_sent": 5,
"email_sent": 12
}
]
}
CSS Styling
The HTML embed uses the following CSS classes that you can customize:
| Class | Element |
|---|---|
.tmsg_h1 |
Team name headline |
.tmsg_listdiv |
Container for message table |
.tmsg_table |
Message table |
.tmsg_row |
Message header row (date, sender) |
.tmsg_date |
Date/time cell |
.tmsg_from |
Sender name cell |
.tmsg_teamname |
Team list address cell |
.tmsg_icons |
Delivery icons (SMS/email) |
.tmsg_textrow |
Message text row |
.tmsg_text |
Message text cell |
.tmsg_footer |
Footer with TeamMessage link |
.tmsg_error |
Error message |
.tmsg_empty |
No messages placeholder |
You can provide a custom CSS URL with the css parameter to override styles:
Custom CSS
...&css=https://example.com/my-widget-styles.css
Finding Your Teamlist IDs
To find the teamlist IDs for your team lists:
- Log in to your account
- Go to Team Lists
- The teamlist ID is shown in the list or in the team list settings
You can display messages from multiple team lists by separating the IDs with commas:
tl=123,456,789
Error Responses
| HTTP Status | Code | Description |
|---|---|---|
401 |
-1 |
API token required or invalid |
400 |
-4 |
No valid teamlist IDs provided |
400 |
-5 |
Team not found or no valid teamlists for team |
Example
Complete curl Example
# By teamlist ID
curl "https://www.teammessage.eu/api/v1/widget/messages/?tm=100042&tl=123,456&nu=5&token=YOUR_TOKEN"
# By teamlist email
curl "https://www.teammessage.eu/api/v1/widget/messages/?tm=100042&teamlist_email=alerts@tmsg.de&nu=5&token=YOUR_TOKEN"
# HTML format (full page for iframe)
curl "https://www.teammessage.eu/api/v1/widget/embed.html?tm=100042&tl=123,456&nu=5&fp=1&token=YOUR_TOKEN"
Legacy URL
The legacy URL showtmsg.php is still available for backwards compatibility. However, it now requires an API token:
https://www.teammessage.de/mbr/showtmsg.php?tm=100042&tl=123&token=YOUR_TOKEN