Message groups and templates
Create templates, place them in a message group, and use that group when a job is activated. A group can optionally reference an owned policy group.
Authentication
Every route requires a bearer token for a user, admin, or root principal. The API determines resource ownership from the token; do not send owner.
Message groups
| Route | Required fields | Optional fields and behavior |
|---|---|---|
POST /v1/members/message/group/get |
id or name |
Returns one owned group, its linked templates, and its linked policy group. |
POST /v1/members/message/group/list |
None | Exact filters: id, name, label, policy_group; supports shared pagination. |
POST /v1/members/message/group/save |
name, label |
id updates an owned group; description, policy_group, and metadata are optional. |
POST /v1/members/message/group/delete |
id or name |
Deletes the group and its template links, but does not delete templates. |
Save a message group
| Field | Required | Type | Description |
|---|---|---|---|
id |
No | UUID | Existing owned group to update. |
name |
Yes | String | Stable owner-scoped group key. |
label |
Yes | String | Human-readable group label. |
description |
No | String or null |
Optional group description. |
policy_group |
No | UUID | Owned policy group to associate with the group. Omit or send an empty value for no association. |
metadata |
No | Object or null |
Application-defined group data. |
Save supplies the complete editable group record: omitted optional fields are stored as empty or null values. policy_group, when present, must belong to the caller.
curl -sS https://api.post.m7.org/v1/members/message/group/save \
-H 'Authorization: Bearer ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"name": "email-proof",
"label": "Email proof messages",
"description": "Templates used for recipient verification"
}'
{
"status": 1,
"comment": "OK",
"data": {
"saved": true,
"item": {
"id": "MESSAGE_GROUP_UUID",
"name": "email-proof",
"label": "Email proof messages",
"template_ids": [],
"templates": [],
"policy_group_item": null
}
}
}
Store the group ID for template links and jobs. get and list return these same relationship fields.
Message templates
| Route | Required fields | Optional fields and behavior |
|---|---|---|
POST /v1/members/message/template/get |
id, or channel and name |
Returns one owned template and its linked groups. |
POST /v1/members/message/template/list |
None | Exact filters: id, channel, name, label, status, is_default; supports shared pagination. |
POST /v1/members/message/template/save |
channel, name, label, body_text |
id updates an owned template; see the field table. |
POST /v1/members/message/template/delete |
id, or channel and name |
Deletes the template and its template-group links. |
Save a template
| Field | Required | Type | Description |
|---|---|---|---|
id |
No | UUID | Existing owned template to update. |
channel |
Yes | String | email or sms. |
name |
Yes | String | Stable template key, unique for the owner and channel. |
label |
Yes | String | Human-readable label. |
body_text |
Yes | String | Plain-text message content. |
status |
No | String | active (default) or disabled. |
is_default |
No | Boolean | Defaults to false. |
subject |
No | String or null |
Optional email subject. |
body_html |
No | String or null |
Optional HTML message body. |
metadata |
No | Object or null |
Application-defined template data. |
Save supplies the complete editable template record: omitted optional fields use their defaults or become null on update.
curl -sS https://api.post.m7.org/v1/members/message/template/save \
-H 'Authorization: Bearer ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"channel": "email",
"name": "proof-code",
"label": "Email proof code",
"subject": "Your confirmation code",
"body_text": "Use the code sent to you to continue."
}'
The successful response contains data.saved: true and data.item. The item includes id, the saved template fields, group_ids, and groups.
Link a template to a group
The template-link routes manage the relationship between an owned message group and an owned template.
| Route | Required fields | Optional fields and behavior |
|---|---|---|
POST /v1/members/message/group/template/get |
id, or message_group and message_template |
Returns one owned relationship. |
POST /v1/members/message/group/template/list |
message_group |
Optional exact filters: id, message_template; supports shared pagination. |
POST /v1/members/message/group/template/save |
message_group, message_template |
Creates the relationship, or returns the existing relationship unchanged. |
POST /v1/members/message/group/template/delete |
id, or message_group and message_template |
Deletes the relationship only. |
Both message_group and message_template are UUIDs. The group must belong to the caller, and the template must be available to that caller.
curl -sS https://api.post.m7.org/v1/members/message/group/template/save \
-H 'Authorization: Bearer ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"message_group": "MESSAGE_GROUP_UUID",
"message_template": "MESSAGE_TEMPLATE_UUID"
}'
{
"status": 1,
"comment": "OK",
"data": {
"saved": true,
"item": {
"id": "TEMPLATE_LINK_UUID",
"message_group": "MESSAGE_GROUP_UUID",
"message_template": "MESSAGE_TEMPLATE_UUID"
}
}
}
The returned item also includes message_group_item and message_template_item. Link an email template before activating any job that delivers email or requires email proof.
Errors and ownership
get,delete, and update operations return a not-found result when the requested resource is absent or is not owned by the caller.- A message group cannot reference a policy group owned by someone else.
- Deleting a message group or template removes only its relationship links; the linked template or group remains available.