Legacy Dev Forum Posts

 View Only

Sign Up

Uploading attachments onto an email

  • 1.  Uploading attachments onto an email

    Posted 06-05-2025 18:13

    sbrebels | 2018-06-05 11:37:53 UTC | #1

    Hi,

    I'm trying to create a new draft via the Platform API. I found that via /api/v2/conversations/emails/{conversationId}/messages/draft I have control over the attachmentsUri.

    Question though: is it possible in anyway to upload the file towards PureCloud? Or should we host the file ourselves and only provide the URI? If the 2nd (only URI) case: how long should this file be kept? After the actual e-mail is sent, is it then uploaded into purecloud (for historization)?


    tim.smith | 2018-06-05 12:52:42 UTC | #2

    There's no public documentation for how to do this, but here's the example I got from the dev team. This is a HTML form posting to the API URL. This can be replicated in code to make the same POST request with form data content. It appears the important parts are the form action URL and the two form inputs for the conversation ID and the file.

    <form action="https://api.mypurecloud.com/uploads/postino-attachments?token=<User-Auth-Token>" method="post" enctype="multipart/form-data">
        <errors path="*" cssClass="errorblock" element="div" />
        Please select a file to upload :<input type="file" name="file" /><br />
        ConversationId: <input type="text" name="conversationId" /><br />
        <input type="submit" value="upload" />
        <span><form:errors path="file" cssClass="error" /></span>
    </form>

    I've created CS-1140 to have documentation written for this.


    tim.smith | 2018-06-06 12:37:46 UTC | #3

    This is now documented on the dev center: https://developer.mypurecloud.com/api/rest/v2/conversations/upload-email-attachments.html


    sbrebels | 2018-06-07 06:09:50 UTC | #4

    Great Tim, thanks we'll give a go.

    A similar question (with regards to uploading files), but about avatars. Let say we want to upload a new avatar (photo taken with mobile phone), I assume a similar approach is required there? (you wouldn't have a code sample by any chance?)

    Thanks


    tim.smith | 2018-06-07 13:25:30 UTC | #5

    I assume you mean a PureCloud user's profile picture? If so, the only supported way to upload new pictures is to use the PureCloud UI; those APIs are not public. I've created CORE-8071 to have those APIs migrated to the Public API.


    system | 2018-07-08 13:25:31 UTC | #6

    This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.


    This post was migrated from the old Developer Forum.

    ref: 2953