Genesys Cloud - Developer Community!

 View Only

Sign Up

  • 1.  Open Messaging Platform to handle iOS customer

    Posted 05-12-2025 09:34
    attachment won't open
    I am using following code to send inbound message with image attachment, but live agent is unable to open that image file. Please attached error file.
    function SendMessageWithAttachementToGenesys(payload){

        var d = new Date();
        ensureAccessToken();

        let data = JSON.stringify({
        "channel": {
            "from": {
            "nickname": payload.nickname,
            "id": payload.id,          // a.b@gmail.com, +16142907944, 48472fdjfdjk423894239jsdfk
            "idType": payload.idType,  // Email, Phone Number, Opaque
            "firstName": payload.firstName,
            "lastName": payload.lastName,
            "email": payload.email
            },
            "time": d.toISOString()
        },
        "text": payload.text,
        "direction": "Inbound",
        "content": [{
            "contentType": "Attachment",
            "attachment": {
                "mediaType": payload.mediaType, // "Image", "Video", "Audio", "File", "Link"
                "url": payload.url, // "https://cdn.corenexis.com/view/?img=d/ma10/lQGou7.jpg"
                "mime": payload.mime, // "image/png" [Attachment mime type (https://www.iana.org/assignments/media-types/media-types.xhtml).]
                "filename": payload.filename // "MyPic.jpg"
            }
        }]
        });

        let config = {
        method: 'post',
        maxBodyLength: Infinity,
        url: 'https://api.usw2.pure.cloud/api/v2/conversations/messages/'+ messageIntegrationId + '/inbound/open/message',
        headers: {
            'Content-Type': 'application/json',
            'Authorization': 'Bearer ' + accessToken
        },
        data : data
        };

        axios.request(config)
        .then((response) => {
        //console.log(JSON.stringify(response.data));
        console.log("\nCustomer> ", response.data.text);
        })
        .catch((error) => {
        console.log(error);
        });

    }

    #Integrations

    ------------------------------
    Parvez Alam
    ------------------------------


  • 2.  RE: Open Messaging Platform to handle iOS customer

    Posted 05-13-2025 14:57

    Hi Parvez,

    Do you have a way to debug your code to check the payload object is sending the file data correctly?
    From Genesys point of view, it looks like the message is being parsed because it shows up ok in the agent UI, so the problem could be in your server side if the URL sends back a corrupted file or perhaps the filename (some filetypes won't open in windows if the extension is wrong, for example a gif file with a jpg extension).



    ------------------------------
    Marco Villaseñor
    Interastar
    ------------------------------



  • 3.  RE: Open Messaging Platform to handle iOS customer

    Posted 05-15-2025 07:49

    Correct. It was server issue where file was hosted.



    ------------------------------
    Parvez Alam
    ------------------------------