{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"Setting Up Message Automations","description":"The operational transportation management API. Full access to planning, tracking, invoicing, and integrations — built on the OTM5 open data standard.","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"setting-up-message-automations","__idx":0},"children":["Setting Up Message Automations"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"objective","__idx":1},"children":["Objective"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Configure automated messages that trigger when transport events occur — for example, emailing a customer when their shipment is delivered, or notifying your team when a transport order is delayed."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"step-1-create-a-message-template","__idx":2},"children":["Step 1: Create a Message Template"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["First, create a reusable message template:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl -X POST https://api.otms.transportial.com/api/messageTemplate \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -d '{\n    \"name\": \"Delivery confirmation\",\n    \"subject\": \"Your shipment has been delivered\",\n    \"body\": \"Dear customer, your transport order {{transportOrder.name}} has been successfully delivered.\"\n  }'\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Response:"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"success\": true,\n  \"message\": \"OK\",\n  \"messageTemplate\": {\n    \"id\": \"template-uuid\",\n    \"name\": \"Delivery confirmation\"\n  }\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"step-2-create-a-message-automation","__idx":3},"children":["Step 2: Create a Message Automation"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Set up the automation that uses this template:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl -X POST https://api.otms.transportial.com/api/messageAutomation \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -d '{\n    \"name\": \"Auto-notify customer on delivery\",\n    \"enabled\": true,\n    \"trigger\": \"transportOrder.status.realized\",\n    \"messageTemplate\": { \"id\": \"template-uuid\" }\n  }'\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Response:"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"success\": true,\n  \"message\": \"OK\",\n  \"messageAutomation\": {\n    \"id\": \"automation-uuid\",\n    \"name\": \"Auto-notify customer on delivery\",\n    \"enabled\": true\n  }\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"step-3-browse-available-templates","__idx":4},"children":["Step 3: Browse Available Templates"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Get pre-built templates to start from:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl -X GET https://api.otms.transportial.com/api/messageAutomation-templates \\\n  -H \"Authorization: Bearer YOUR_TOKEN\"\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"step-4-duplicate-an-existing-automation","__idx":5},"children":["Step 4: Duplicate an Existing Automation"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Clone an existing automation to create a variation:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl -X POST \"https://api.otms.transportial.com/api/messageAutomation/{automation-uuid}/duplicate\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\"\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"managing-automations","__idx":6},"children":["Managing Automations"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"list-all-automations","__idx":7},"children":["List All Automations"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl -X GET \"https://api.otms.transportial.com/api/messageAutomations/0/20\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\"\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"update-an-automation","__idx":8},"children":["Update an Automation"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl -X PUT https://api.otms.transportial.com/api/messageAutomation \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -d '{\n    \"id\": \"automation-uuid\",\n    \"enabled\": false\n  }'\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"view-automation-tasks","__idx":9},"children":["View Automation Tasks"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["See what messages have been sent by this automation:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl -X GET \"https://api.otms.transportial.com/api/messageAutomation/{automation-uuid}/tasks/0/20\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\"\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"managing-message-templates","__idx":10},"children":["Managing Message Templates"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"list-templates","__idx":11},"children":["List Templates"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl -X GET \"https://api.otms.transportial.com/api/messageTemplates/0/20\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\"\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"update-a-template","__idx":12},"children":["Update a Template"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl -X PUT https://api.otms.transportial.com/api/messageTemplate \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -d '{\n    \"id\": \"template-uuid\",\n    \"subject\": \"Delivery confirmed - {{transportOrder.name}}\",\n    \"body\": \"Dear {{customer.name}}, your shipment has arrived at the destination.\"\n  }'\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"preview-a-template-as-a-message","__idx":13},"children":["Preview a Template as a Message"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Generate a preview of how the template will look for a specific chat:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl -X GET \"https://api.otms.transportial.com/api/messageTemplate/{template-uuid}/message/{chatId}\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\"\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"common-automation-triggers","__idx":14},"children":["Common Automation Triggers"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Trigger"},"children":["Trigger"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Transport order status change"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["When an order moves to requested, accepted, planned, realized, etc."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Consignment status change"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["When a consignment starts transit, is delivered, etc."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Trip lifecycle events"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["When a trip starts, finishes, or is delayed"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Custom filter conditions"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Using TQL to match specific criteria"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"automation-with-attachments","__idx":15},"children":["Automation with Attachments"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Automations can include file attachments — for example, attaching a CMR document or proof of delivery photo to the notification email. Attachments are pulled from the transport entity's document list automatically."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"using-chat-for-messaging","__idx":16},"children":["Using Chat for Messaging"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For real-time messaging between users:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"# Create a chat\ncurl -X POST https://api.otms.transportial.com/api/chat \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -d '{\n    \"name\": \"Shipment RTD-AMS discussion\"\n  }'\n\n# Send a message\ncurl -X POST https://api.otms.transportial.com/api/chat/message \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\" \\\n  -d '{\n    \"chatId\": \"chat-uuid\",\n    \"content\": \"The driver is 15 minutes away from the pickup location.\"\n  }'\n\n# Get messages\ncurl -X GET \"https://api.otms.transportial.com/api/chat/messages/{chatId}/0/20\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\"\n\n# Translate a message\ncurl -X GET \"https://api.otms.transportial.com/api/chat/message:translate/{messageId}\" \\\n  -H \"Authorization: Bearer YOUR_TOKEN\"\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"key-takeaways","__idx":17},"children":["Key Takeaways"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Message automations react to entity changes without any code"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Templates support variables that are filled with actual entity data"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Automations can include document attachments"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Use the duplicate endpoint to quickly create variations"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Monitor automation tasks to see delivery status"]}]}]},"headings":[{"value":"Setting Up Message Automations","id":"setting-up-message-automations","depth":1},{"value":"Objective","id":"objective","depth":2},{"value":"Step 1: Create a Message Template","id":"step-1-create-a-message-template","depth":2},{"value":"Step 2: Create a Message Automation","id":"step-2-create-a-message-automation","depth":2},{"value":"Step 3: Browse Available Templates","id":"step-3-browse-available-templates","depth":2},{"value":"Step 4: Duplicate an Existing Automation","id":"step-4-duplicate-an-existing-automation","depth":2},{"value":"Managing Automations","id":"managing-automations","depth":2},{"value":"List All Automations","id":"list-all-automations","depth":3},{"value":"Update an Automation","id":"update-an-automation","depth":3},{"value":"View Automation Tasks","id":"view-automation-tasks","depth":3},{"value":"Managing Message Templates","id":"managing-message-templates","depth":2},{"value":"List Templates","id":"list-templates","depth":3},{"value":"Update a Template","id":"update-a-template","depth":3},{"value":"Preview a Template as a Message","id":"preview-a-template-as-a-message","depth":3},{"value":"Common Automation Triggers","id":"common-automation-triggers","depth":2},{"value":"Automation with Attachments","id":"automation-with-attachments","depth":2},{"value":"Using Chat for Messaging","id":"using-chat-for-messaging","depth":2},{"value":"Key Takeaways","id":"key-takeaways","depth":2}],"frontmatter":{"seo":{"title":"Setting Up Message Automations"}},"lastModified":"2026-03-22T21:04:26.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/examples/message-automations","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}