OS1 Services
...
Messaging
Register Message Notifications
14 min
overview the messaging notifications feature simplifies the process for the app developers to register their app’s messages/notifications so that the tenant admins can review and enable/disable messages as per the tenant’s business needs the feature also enables app developers to register their notifications along with the channels and templates to use to send the notifications the developers can use the registered notifications to quickly send messages in multiple channels using a single api call benefits notification registration developers can register notifications using the messaging notifications apis, specifying details such as the notification name, description, and associated templates with channels to use (sms, email, and whatsapp) tenant admin control tenant admins get the ability to review the registered notifications and decide whether to enable or disable them default template registration additionally, developers can register templates while registering notifications and then use those templates when sending sms, email, and whatsapp notifications multi channel support the feature enables developers to send messages using multiple channels/modes using a single api call instead of making separate api calls for each channel, developers can leverage the sendnotifications api to send sms, email, and whatsapp notifications with a single request managing notifications this guide covers the available apis for registering and updating notifications register notifications to register notifications supported by your application, use the createmessagenotifications api this api allows you to specify the notification details, such as app id, notification name, templates to use with supported channels body parameters true false 192false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type the following createmessagenotifications request registers a new notification group with templates for the sms, email, and whatsapp channels { "name" "order notifications", "label" "order notifications", "description" "notification group for order related messages", "templates" { "sms" \[ "order confirmation sms", "order shipped sms" ], "email" \[ "order confirmation email", "order shipped email" ], "whatsapp" \[ "order confirmation whatsapp", "order shipped whatsapp" ] } } in this example, a notification group named "order notifications" is created with template names for sms, email, and whatsapp channels the template names refer to pre defined templates that should be registered separately the response includes the data object with the name of the notification { "data" { "name" "order notifications" } } send messages with notificationid use the sendmessagenotifications api to send messages to users via multiple channels such as sms, email, and whatsapp with a single api call this request allows developers to specify notification details, recipient information, and provider configurations body parameters here's a markdown table for the sendmessagenotifications request using the provided schema true false 165false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type false left unhandled content type example request { "notifications" \[ { "data" { "otp" "235523" }, "sms" { "senderid" "dlhvry", "provider" "aws pinpoint", "to" \[ { "countrycode" "91", "number" "9812345600" } ] }, "email" { "provider" "aws ses default", "from" "noreply\@example com", "replyto" "support\@example com", "to" \[ "user\@example com" ], "cc" \[ "manager\@example com" ], "bcc" \[ "archive\@example com" ], "attachments" \[ "https //example com/attachments/invoice pdf" ] }, "whatsapp" { "from" "123324242", "provider" "infobip", "media" { "document" { "url" "https //example com/documents/user guide pdf", "filename" "user guide pdf" }, "image" { "url" "https //example com/images/product image jpg" }, "location" { "latitude" 37 7749, "longitude" 122 4194 } }, "buttons" \[ "track order", "contact support" ], "to" \[ { "countrycode" "91", "number" "9812345600" } ] } } ], "callback" { "url" "https //os1 test msg callback requestcatcher com/test", "meta" { "clientid" "client123", "notificationid" "notification456" } } } the example sends a notification with the following details the data object contains an otp value to be used in the notification templates the sms object specifies the sms notification details, including the sender id, provider, and recipient information the email object specifies the email notification details, including the provider, sender email, reply to email, recipient emails (to, cc, bcc), and an attachment url the whatsapp object specifies the whatsapp notification details, including the sender number, provider, media attachments (document, image, location), buttons, and recipient information the callback object specifies the callback url and metadata for the notification status updates update notification templates call updatemessagenotificationtemplates to update templates associated with a notification path parameters true falsefalse unhandled content type false unhandled content type false unhandled content type false unhandled content type the following updatemessagenotificationtemplates request updates what’sapp template while keeping the same label and description fields the templates object only includes the whatsapp array, leaving the sms and email arrays unchanged { "label" "updated shipment notifications", "description" "updated notification group for sending shipment updates", "templates" { "whatsapp" \[ "your shipment {{shipmentid}} has been dispatched from our warehouse expected delivery date {{deliverydate}} you can track your shipment using this url {{trackingurl}}", "good news! your shipment {{shipmentid}} is out for delivery and will reach you today by {{deliverytime}} if you have any special instructions for the delivery, please reply to this message or contact our support team at {{supportcontact}} thank you for choosing our services!" ] } } retrieve notifications you can retrieve a single notification by name or all notifications using the following endpoints use the getmessagenotificationdetails endpoint to retrieve a notification by providing the notification name in the path use the getallmessagenotifications endpoint to retrieve a list of notifications providing the appid and mode query parameters update notification modes the updatenotificationmodes endpoint allows business admins to choose to enable or disable notification modes an app can send in the ui path parameters true falsefalse unhandled content type false unhandled content type false unhandled content type false unhandled content type body parameters true false 221false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type false unhandled content type the following updatenotificationmode request sets sms and whatsapp to true and leaves email false { "modes" { "sms" true, "email" false, "whatsapp" true } }