How to use attachments with omni-channel messaging API.

 

SCG platform supports 2 ways of specifying media content for messaging and voice calls.

  • Creating an attachment resource and referencing it in the API request via an unique attachment resource ID.
  • Specify an inline media URL that references media content in an external storage.

Most common use cases for media content would be

  • Attachment of a image or document as message content.
  • Media content to support playing an audio or a video to enhance the experience.

The following channels support the use of attachments

  • MMS
  • RCS
  • Push
  • WeChat
  • WhatsApp
  • Facebook
  • Voice

How to create re-usable media content ? 

Step 1 : Create an attachment resource.

POST ../scg-external-api/api/v1/messaging/attachments

Request body:

{
    "name":"MyFirstMediaAttachment",
    "type":"application/pdf",
    "filename":"Document.pdf"
}

 

Step 2 : Create an access token for the above attachment. Reference the unique attachment resource identifier returned in Step 1

POST ../scg-external-api/api/v1/access_tokens

Request body:

{
    "resource":"ATTACHMENT",
    "resource_id":"EeVXFaamnFiBwcwYNYGjA3",
}

 

Step 3 : Upload the attachment as multipart form data. Specify the access token generated in Step 2

POST /scg-attachment/api/v1/messaging/attachments/{accessTokenId}/content

 

Once the attachment is successfully created and the media is uploaded, the unique attachment resource identifier can be referenced when sending messaging or voice API request. 

 

How to reference media content from an external storage provider ?

When sending API requests for messaging or voice calls, external media content  can be referenced as a media URL.

 

Attachment Retention Policy

Any attachments uploaded to the SCG platform will be archived and would not be available for use 7 days from the time of the initial upload.

If any media content like logos is being regularly reused, it is strongly advised to refresh your reusable media content prior to the 7 day archival period.

 

Uploading Attachments via the SCG UI

Attachments can be managed via the Voice and Messaging Console. Log into your account using valid credentials and navigate to the attachments section using the 'Attachments' menu under the left navigation (under Messaging).

 

mceclip0.png

 

Best Practices

  • Create attachment resources for re-usable media content as it is easy to reference it in the API requests.
  • Media content that is message context specific (one-time use) should be handled via media URLs. 

Supported Media Requirements for Channels 

Every channel enabled by the omni-channel API has different requirements in terms of what type of media are supported, how large the content size can be and how many attachments can be specified for a given message or voice call.

MMS

Facebook

 

Was this article helpful?
0 out of 0 found this helpful

0 Comments

Article is closed for comments.