Skip to main content

When a user uploads an attachment in a conversation, we observed that:

  1. The webhook payload contains an html string with the file URL somehwere inside it:
    "body": "<div class=\"intercom-container\"><img src=\"https://downloads.intercomcdn.com/i/o/112xxxxx53/131xxxx01249e994131/image.png?expires=1722233700&signature=8a70c55c0ed3000c00ae533xxxxxxxxebc3407b10136029aff26bd5f3c3\"></div>"

     

  2. In custom actions using `Last Message Body` we get
  3.  "payload": ""Image \"some-file.png?expires=1722255300&amp;signature=f0e6d92d99861c0046910ace7821c80c06850fad91498faxxxxxxxxxxxxxx\"]",

We ask:

  1. How to get the file url as plaintext, not html, in webhook
  2. how to get complete file url in custom actions
  3. When user uploads multiple files we get multiple webhook events - and not a single one with all the files inside of it. It means we have to somehow wait and aggregate webhooks, but we wouldn’t know when to stop. Is there a way to receive multiple files on a webhook?
  4. We couldn’t get multiple files as the payload in the custom actions. is it possible?
  5. Is there a way to download a file  / get a file url via API? (generating a URL that is valid, if we want to access this file programmatically after 30 minutes).

Thanks

Hi @Guy Shaanan Ebenezer here from Engineering Support👋.

I see you were able to get in touch with our Support team over the Messenger and got the answers to your questions there.

I’ll also post the answer here.

1. How to get the file url as plaintext, not html, in webhook
​Currently, it isn't possible to directly obtain plain text from webhooks as the data is not provided in that format out of the box. To get the raw text content from messages, you would need to parse the conversation_parts. This process may require some coding knowledge or the assistance of a developer.

2. How to get complete file url in custom actions
What endpoint are you currently using? The complete file should be returned via a custom action.

3. When user uploads multiple files we get multiple webhook events - and not a single one with all the files inside of it. It means we have to somehow wait and aggregate webhooks, but we wouldn’t know when to stop. Is there a way to receive multiple files on a webhook?
Currently this would be expected behaviour. The webhook would be triggered each time a file is uploaded separately. You would have to create a custom integration to stringify the webhook responses together.

4. We couldn’t get multiple files as the payload in the custom actions. is it possible?
I don't see how this wouldn't be possible 🤔 This would however depend on your endpoint call, and the response given from the API.

5. Is there a way to download a file / get a file url via API? (generating a URL that is valid, if we want to access this file programmatically after 30 minutes).
​URLs for user-uploaded images and files through Intercom have a 30-minute expiration as you mentioned. After this period, the link will no longer be valid and will result in a 404 error. However, you can generate a new URL by fetching the conversation data again. This means while you cannot directly download a file or get a file URL via API that remains valid indefinitely, you can access the file programmatically by generating a new URL before the previous one expires, every 30 minutes.


Reply