Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

log message id returned from MessageBird REST API when sending sms #512

Open
phavekes opened this issue Dec 1, 2024 · 0 comments
Open

Comments

@phavekes
Copy link
Member

phavekes commented Dec 1, 2024

This issue is imported from pivotal - Originaly created at Jul 29, 2020 by Joost van Dijk

To make it easier to debug sms delivery issues, it is useful to be able to track a messages status. This can be done through the MessageBird Web console based on the message's recipient, but this is not always possible due to MessageBird's 2FA restrictions.

Another way is to use the REST API itself, but this requires the message's ID instead of the recipient's mobile phone number.

example:

For a .id key value "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" returned from the messages API (POST) when sending an SMS, we can retrieve the status (GET) using

https://rest.messagebird.com/messages/0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef

The response .recipients key could read:

{
"totalCount": 1,
"totalSentCount": 1,
"totalDeliveredCount": 1,
"totalDeliveryFailedCount": 0,
"items": [
{
"recipient": 31612345678,
"originator": null,
"status": "delivered",
"statusDatetime": "2020-07-29T10:22:37+00:00",
"messagePartCount": 1
}
]
}

for a successful delivery, or for a stalled message:

{
"totalCount": 1,
"totalSentCount": 1,
"totalDeliveredCount": 0,
"totalDeliveryFailedCount": 0,
"items": [
{
"recipient": 31612345678,
"originator": null,
"status": "sent",
"statusDatetime": "2020-07-28T14:32:28+00:00",
"messagePartCount": 1
}
]
}

If the .id value is logged, together with the recipient phone number, this would make it easy to use the API for obtaining the status.

Currently, only the error and status directly after sending is retained:
https://github.com/SURFnet/messagebird-api-client-bundle/blob/develop/src/Surfnet/MessageBirdApiClient/Messaging/MessagingService.php#L85

IT would be useful to also retain the message ID for logging purposes.

NOTE: there is a downside in logging, as this also makes it easier to retrieve the actual OTP in the message body.

Please discuss...

@phavekes phavekes self-assigned this Dec 1, 2024
@phavekes phavekes added this to Stepup Dec 1, 2024
@github-project-automation github-project-automation bot moved this to New in Stepup Dec 1, 2024
@phavekes phavekes removed their assignment Dec 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: New
Development

No branches or pull requests

1 participant