Thursday, January 12, 2023

Create and Send SMS in D365 Marketing

 In Dynamics 365 Marketing, you can use the SMS message type to create and send SMS messages to contacts or leads in your database. The process for creating and sending an SMS message involves several steps:

  1. Create an SMS message template: In Marketing, navigate to Email and SMS > SMS message templates, and create a new template. In the template, you can specify the message content, and include personalization fields to dynamically insert information from the contact or lead record.

  2. Create an SMS message: In Marketing, navigate to Email and SMS > SMS messages, and create a new message. In the message, you can specify the recipient list, select the SMS message template, and set the send options.

  3. Send the SMS message: After creating the SMS message, you can send it immediately or schedule it to be sent at a later time.

Here's a sample process on how to send SMS message by using a sample code

var smsMessage = { recipientList: { query: "contacts", filter: "statuscode eq 1" }, template: { id: "cf5b5f0f-cbc4-45c9-9edf-e8a0da22b2d4" }, sender: { id: "c1b5f0f-cbc4-45c9-9edf-e8a0da22b2d3" }, sendImmediately: true }; var smsMessageId = Xrm.WebApi.createRecord("sms", smsMessage).then( function success(result) { var smsId = result.id; console.log("SMS created with ID: " + smsId); }, function (error) { console.log(error.message); });

This is just a simplified example, in your real scenario you may have to customize it as per your need, like you may have to import required types and apply the appropriate configurations options. Please note that in order to use this sample code, you must have the appropriate permissions to create and send SMS messages in Dynamics 365 Marketing, and you must have an active SMS message template and SMS sender account set up in your system.

Please be aware that SMS messaging is generally regulated, and laws and regulations vary by country. Before sending SMS messages to contacts or leads, you should familiarize yourself with any relevant laws and regulations, and obtain any necessary consent from your contacts or leads.

No comments:

Post a Comment