vinoth87
vinoth87

Reputation: 304

Can't send MMS programmatically using vonage

I have used this reference(https://developer.vonage.com/en/messages/code-snippets/mms/send-mms?lang=javascript) for sending MMS

vonage.messages.send(
  new Image({ "url": IMAGE_URL }, TO_NUMBER, FROM_NUMBER)
)
.then(resp => console.log(resp.message_uuid))
.catch(err => console.error(err));

I am 100% sure I used valid credentails, because I can able to send sms. Only mms got failed.

I got below error

data: {
  type: 'https://developer.nexmo.com/api-errors/#unathorized',
  title: 'You did not provide correct credentials.',
  detail: "Check that you're using the correct credentials, and that your account has this feature enabled",
},

After searching I find this link (https://api.support.vonage.com/hc/en-us/articles/4412210010644-Why-am-I-getting-401-Unauthorized-error-when-sending-messages-with-Messages-API-version-1-)

As per the link I used api version 1 and my from number also linked with my application created in vonage account.Their statement was I should must use JSON Web Token (JWT) authentication; otherwise, you will get 401 unauthorized errors.

Is the vonage server sdk didn't use JWT authentication?

 const { Vonage } = require('@vonage/server-sdk')

Then guide me how to do with @vonage/server-sdk and JSON Web Token used to send MMS from my node.js ?

Thanks in advance.

Upvotes: 0

Views: 146

Answers (0)

Related Questions