While trying to broadcast different types of media through Omnichannel, or create a template with media through API, it will require a direct link to the media, to add them as a header.
1. Copy the Media URL from Approved WhatsApp Template
If you are trying to send a WhatsApp broadcast template and need a media direct URL for the header in your CSV or API, you can copy the default URL of the media you have uploaded when submitting the template.
1. Open Outbound Menu > WhatsApp Broadcast Templates > choose the desired template
2. Click the Copy Media Link then you can use it now.
Note: if the Media Link format from this step is like https://scontent.whatsapp.net/v/t61.29466-34/366776884_25016xxx, the link will not work if used as a header parameter. So, please try method number 2 or 3 below.
2. Using Omnichannel Dashboard to Get a Media Direct URL
1. Open a session with yourself
2. As an Agent or Admin on your Omnichannel, send your image by clicking this button and choosing your desired image
3. Once the image is uploaded, click right on the image and then choose "copy image address"
Or you can choose "open image in new tab", and see the image URL:
4. Copy and save your URL for use later.
Note:
- You must get the image direct URL in order to use them. (example: https://d1edrlpyc25xu0.cloudfront.net/rir-i1gavwtrrzsh7vk6h/image/upload/ELLurDvx9s/qiscus_badge.png)
- Image cannot be followed by text/caption.
- You may remove the slash /w_320,h_320,c_limit to get a better image resolution.
3. Using API to Get a Media Direct URL
1. You need to get the SDK token before uploading the image
curl --location --request POST 'https://api3.qiscus.com/api/v2/sdk/login_or_register' \
--header 'qiscus-sdk-app-id:{{appid}}' \
--header 'content-type: application/x-www-form-urlencoded' \
--data-urlencode 'email=example@random.com' \
--data-urlencode 'password=123456789' \
--data-urlencode 'username=User Upload'
2. Uploading images using API
curl --location --request POST 'https://api3.qiscus.com/api/v2/sdk/upload' \
--header 'qiscus_sdk_app_id:{{appid}}' \
--header 'qiscus_sdk_token:{{token}}' \
--form 'file=@"elXDTpDyE/unnamed.jpeg"'
3. or using Secret Key Omnichannel (no need to get SDK token in step 1-2)
curl --location --request POST 'https://api3.qiscus.com/api/v2/sdk/upload' \
--header 'qiscus_sdk_app_id:{{appid}}' \
--header 'qiscus_sdk_secret:{{secret_key}}' \
--form 'file=@"elXDTpDyE/unnamed.jpeg"'
Example response
{
"results": {
"file": {
"name": "Qiscus.jpeg",
"pages": 1,
"size": 33184,
"url": "https://d1edrlpyc25xu0.cloudfront.net/rxxo-2xxxx8b1ulxxxxo/image/upload/RiT8fbCpVK/Qiscus.jpeg"
}
},
"status": 200
}
Comments
0 comments
Please sign in to leave a comment.