Share via

Power Automate: OneDrive image URL not working as Twilio WhatsApp MediaUrl

Ayesh Thilanka 0 Reputation points
2026-05-14T09:19:45.18+00:00

Hi ,

I'm building a Power Automate flow to forward Power BI alert emails to WhatsApp using Twilio.

My flow:

User's image

  1. Trigger - When new email arrives (Outlook)
  2. Get attachment - extracts the .png image from the email
  3. Create file - saves image to OneDrive for Business
  4. Create share link - generates "Anyone can view" link
  5. HTTP POST - sends to Twilio WhatsApp API with MediaUrl

The problem:

Twilio requires a direct publicly accessible image URL that returns content-type: image/png. The OneDrive share link redirects to a preview page (text/html) instead of serving the raw image - so Twilio rejects it with error "Invalid media URL".

Question:

Is there any way inside Power Automate to get a direct publicly accessible .png URL from OneDrive for Business that Twilio (or any external service) can fetch without authentication?

Or is there a recommended alternative storage solution within the Microsoft ecosystem that works for this?

Environment:

  • Microsoft 365
  • Power Automate cloud flow
  • OneDrive for Business
  • Twilio WhatsApp Sandbox

Any help appreciated. Thank you.

Microsoft 365 and Office | Install, redeem, activate | For business | Other
0 comments No comments

2 answers

Sort by: Most helpful
  1. Killian N 1,140 Reputation points Independent Advisor
    2026-05-14T09:41:40.0166667+00:00

    Hi @Ayesh Thilanka 

    Thank you for reaching out and sharing your scenario. From your description, it’s clear that you’re working on a Power Automate flow to forward Power BI alert emails to WhatsApp via Twilio, and you’ve encountered an issue with using images stored in OneDrive for Business as the media source. 

    Specifically, Twilio requires a direct, publicly accessible image URL that returns a valid content-type such as image/png. However, the sharing link generated by OneDrive for Business redirects to a web-based preview page (serving text/html) rather than delivering the raw image file itself. Because of this, Twilio is unable to retrieve the image and returns an “Invalid media URL” error. 

    To clarify, this behavior is expected. OneDrive for Business does not natively provide fully anonymous, direct-access file URLs that consistently serve raw file content without authentication or redirection. Even when a file is shared externally, the generated link typically routes through a preview or download experience rather than exposing a clean, static file endpoint suitable for third-party services like Twilio. As a result, Power Automate cannot reliably produce a direct .png URL from OneDrive that meets Twilio’s requirements. 

    Although Power Automate and OneDrive integrate well for internal workflows, they are not designed to act as a public file hosting solution for external integrations that require direct, unauthenticated access. This limitation is why your current approach is not working, even though the flow itself is correctly configured. 

    As an alternative, you may consider using a storage option that supports publicly accessible direct file URLs. Within the Microsoft ecosystem, Azure Blob Storage is commonly used for this purpose, as it allows you to generate secure, direct links (for example, using SAS tokens) that return the raw file content with the correct MIME type. This makes it compatible with services like Twilio. Depending on your requirements, other external hosting platforms that provide direct file access could also be used. 

    Given that your question involves a combination of OneDrive, Power BI, and Power Automate workflow design, the most suitable place to receive specialized guidance would be the Microsoft Power Platform forum. Experts there can help you explore supported patterns, suggest alternative architectures, and provide updates on any future enhancements to OneDrive or Power Automate that might simplify this scenario. User's image

    I hope this explanation helps clarify why the archiving operation is not working and assists you in determining the next steps for your process. If you find this response helpful, please consider marking it as the Accepted answer, so others in the community with the same question can benefit. 

    Thank you again for participating in the forum, and please feel free to reach out anytime if you need further assistance. 


    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread. 

    Was this answer helpful?

    0 comments No comments

  2. AI answer

    2026-05-14T09:20:07.2566667+00:00

    Power Automate and OneDrive for Business don’t provide a way to generate a truly anonymous, raw binary URL for a file that behaves like a static CDN endpoint (that is, returns image/png directly with no HTML preview or auth) from inside the standard OneDrive for Business connector. The “Create share link” action produces a sharing URL that’s intended for interactive use and can redirect to an HTML preview page, which doesn’t meet Twilio’s requirement for a direct media URL.

    Within the provided guidance, OneDrive share links are used for scenarios such as:

    • Embedding images in emails by referencing the share link in an <img src="..."> tag in Power Automate emails.
    • Returning a Web URL back to Power Pages or Forms and then using it in HTML or email content.

    These patterns assume a browser or email client that can follow the link and render HTML. They do not guarantee a raw, unauthenticated file stream suitable for Twilio’s MediaUrl requirement.

    Because of this, there is no supported pattern in the referenced material that would allow configuring OneDrive for Business in Power Automate to expose a direct, public .png URL consumable by Twilio without authentication.

    The documentation instead shows that OneDrive share links are best used for:

    • Email scenarios (for example, clickable links or inline images) where the client can handle HTML and redirects.
    • Power Pages and similar apps where the link is consumed by Microsoft-first-party components.

    Given these constraints, the documented approach does not provide a way to satisfy Twilio’s strict MediaUrl requirement using OneDrive for Business alone, and no alternative Microsoft storage service with a documented, anonymous, direct-image URL pattern is described in the provided context.


    References:

    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.