Home > Blockchain >  MessageBird - message not found
MessageBird - message not found

Time:11-12

I've been trying to follow the docs at MessageBird to test out sending a verification SMS. But when I execute the curl command, the returned response is as expected here:

{"id":"e41c509641a34324a0e1333a4e87d84d","href":"https://rest.messagebird.com/verify/e41c509641a34324a0e1333a4e87d84d","recipient":447000000000,"originator":" 447000000000","type":"sms","reference":null,"messages":{"href":"https://rest.messagebird.com/messages/d18f22ae466g4c349799404d878c9815","id":"d18f22ae466g4c349799404d878c9815"},"status":"sent","createdDatetime":"2021-11-11T15:19:01 00:00","validUntilDatetime":"2021-11-11T15:19:31 00:00"}

But, if you open up the href link from the response it gives the following error:

{"errors":[{"code":20,"description":"message not found","parameter":null}]}

This is the curl request that I use:

curl --location --request POST 'https://rest.messagebird.com/verify' --header 'Authorization: AccessKey ACCESS_KEY'  --header 'Content-Type: application/x-www-form-urlencoded' --data-urlencode 'recipient= 447000000000' --data-urlencode 'originator=07000000000'

CodePudding user response:

Make sure that you are using a Live key and not the Test key, as the Test environment does not store any of your requests.

If you are looking for a sample response to work with, here is one I just got back:

GET https://rest.messagebird.com/verify/<VID>

{
  "id": "<VID>",
  "href": "https://rest.messagebird.com/verify/<VID>",
  "recipient": 27830000000,
  "originator": "Code",
  "type": "sms",
  "reference": null,
  "messages": {
    "href": "https://rest.messagebird.com/messages/<MID>",
    "id": "<MID>"
  },
  "status": "sent",
  "createdDatetime": "2021-11-11T16:25:06 00:00",
  "validUntilDatetime": "2021-11-11T16:25:36 00:00"
}

GET https://rest.messagebird.com/messages/<MID>

{
  "id": "<MID>",
  "href": "https://rest.messagebird.com/messages/<MID>",
  "direction": "mt",
  "type": "sms",
  "originator": "Code",
  "body": "",
  "reference": null,
  "validity": null,
  "gateway": 10,
  "typeDetails": {
    "verify": true
  },
  "datacoding": "plain",
  "mclass": 1,
  "scheduledDatetime": null,
  "createdDatetime": "2021-11-11T16:25:07 00:00",
  "recipients": {
    "totalCount": 1,
    "totalSentCount": 1,
    "totalDeliveredCount": 1,
    "totalDeliveryFailedCount": 0,
    "items": [
      {
        "recipient": 27830000000,
        "originator": null,
        "status": "delivered",
        "statusDatetime": "2021-11-11T16:25:14 00:00",
        "recipientCountry": "South Africa",
        "recipientCountryPrefix": 27,
        "recipientOperator": "",
        "messageLength": 20,
        "statusReason": "successfully delivered",
        "price": {
          "amount": 0.021,
          "currency": "EUR"
        },
        "mccmnc": "65507",
        "mcc": "655",
        "mnc": "07",
        "messagePartCount": 1
      }
    ]
  }
}
  • Related