Get SMS sent using Azure Communication Services

28 Views Asked by At

We were using Twilio to manage sending SMS from our product. Twilio has an API that allows us to fetch messages sent from a given account, to a given phone number. We are using this in our end-to-end testing scenarios to get a SMS message sent from our platform and validate its contents.

We had to change from Twilio to Azure Communication Services for business-related reasons. I've looked through the ACS docs, yet could not find a way to get messages sent from us to a given number. Is there a way to do it that i'm missing?

For example, here is what it looks like using the Twilio node library:

const client = require('twilio')(accountSid, authToken);
module.exports = async (phoneNumber) => {
  const today = DateTime.now();
  const sentDate = new Date(today.year, today.month - 1, today.day, today.hour, today.minute - 1);
  try {
    const messages = await client.messages.list({
      limit: 10,
      to: phoneNumber,
      dateSentAfter: sentDate,
    });
    return messages;
  } catch (error) {
    console.error(error);
    return null;
  }
};

Thanks in advance!

I looked into the documentation for Azure Communication Services but I am unable to find any information regarding fetching SMS sent from your account.

0

There are 0 best solutions below