Skip to main content

Is there a way to add an image to an sms campaign through the api? I found a media_url field in the return data for the campaign-messages endpoint but when I try to set a value for that to update or create it doesn’t seem to work. 

 

Hi @obviyo 

 

Thanks for your question in the community.

I haven’t added images yet to MMS as its not available in all countries, but this article might be helpful for you. 

 

thanks

Vic


Hey @obviyo 

The media_url should be a publicly accessible URL. It cannot be a local file path or a URL that requires authentication. Make sure the image is hosted on a server that allows public access.

let me know if this fixes it.

Cheers and thank you for being part of this amazing community

Arpit


Hi @ArpitBanjara 

Even if I try to use a publicly available image I still get the same error message: “media_url” is not a valid field for the resource “content” (See screenshot below)

Thanks


Hey @obviyo 

can you confirm if you have already done the below?

In your uploaded screenshot, the media_url is set to null. Make sure to replace null with the actual URL of your image. 

something like below 

{
"attributes": {
"label": "Test SMS API Campaign",
"channel": "sms",
"content": {
"body": "Get this while it lasts!",
"media_url": "https://example.com/path/to/your-image.jpg"
}
}
}

let me know


Right, so I’m actually sending in a message through patch request to /api/campaign-messages/{MESSAGE_ID_HERE} that looks very similar to what you have above but it is returning to me with the media_url as null. I’m never setting media_url to null it just always returns as null. See my fuller screenshot below. The above json is what I’m actually sending in. I’ve tried with all kinds of different publicly available image links and it always comes back with the media_url as null.

Thanks again for your help in looking into this.


@obviyo Have you figured this one out yet or do you still need help?


I still don’t see a way to add a dynamic image using the api. The attempts above did not work for me. I only ever see null returned for the media_url as mentioned above and that doesn’t seem to correspond to the dynamic image url I set if I try to use the api to pull back an sms campaign I setup in the ux.

 

Thanks!


Reply