Send the contact a message
3 minutes read Beginner
Send the contact a message
It sends the message to the contact in the flow. You can also add variables in the content of the message to publish the value in the message. Text messages can contain up to 4096 characters. Refer Supported Contect Types to know more about it.
Refer Flow level & Contact level variables to know more about how to use variables in flow.
Send media files in a Message
Glific users can upload the media files directly from their computer
or
Upload the files on GCS and use the URL as attachment in multiple flow.
Upload the media files directly from your computer.
1 . Open a flow from where you want to send the file as an attachment.
2 . Create a Send message
Note.
3 . Click on attachment
tab.
4 . Choose upload attachment option from dropdown
5 . Computer folders window will open up. Choose the file you want to upload.
Note : WhatsApp business API doesn't support .gif files to be send as messages. Use .jpeg or .png to send as an attachment. For more details please refer https://developers.facebook.com/docs/whatsapp/cloud-api/reference/media/
6 . After successful upload, option to download and remove the attachment will be shown.
7 . Click on ok
button to save the attachment in the node.
8 . Test the flow to verify the attachment sent with the message.
Note :- To give a name to the attachment, Enter the name in the send message box. Other wise the attachment will be names ad NULL.
Upload media file in GCS
- Upload the file you want to send to the contact. Refer to the integration with the GCS article for detailed steps.
- Copy the public URL of the image uploaded.
Send media file with dynamic file names
Note - It will require a developers assistance to use this feature. Please check with your tech team or consult Glific team, if you wish to use this feature.
Use case :- Expression
option is used in attachment, when there is a requirement to send media files with dynamic names.
For an example: The requirement is to send the map on the basis of the city contact belongs to.
1 . Upload map files of all cities in the GCS.
2 . Use the expression to pass the contact's city name in the attachment .
Syntax- <%= "@results.city_name" %>.
3 . In a flow, city map will be send as per the contact's city
Use Expression
option from the dropdown, if media files name are needed to send with dynamic name.
The value of expression will be a variable and the syntax used in is <%= "@results.fieldname" %>
Attach the media file in a message
-
While editing a flow, select
Send a message
node. -
Click on the
Attachments
tab.
- Select the relevant media file option from the dropdown and paste the URL copied from GCS.
Note: google drive URLs will not work in this attachment
4 . Click ok
to save.
Test the media message in the simulator
- Run the simulator with the
preview
button(bottom right) on the flow editor screen. Select the required response and you will see the media file in the simulator.
Note:- Need to add some text in the send message node, otherwise the attachment will not be sent through flows
Size of image
Please use images of less than 5 MB. It is the maximum size limit currently.
Maximum size limit
- image file=> 5.120 MB
- Video file => 16.384 MB
- Audio file => 16.384 MB
- Document file => 102.400 MB
- Sticker file => 0.09 MB
Please Note : Whatsapp doesn't support send message node with audio file. Instead of using a single send message node, you can use two separate nodes for text and audio.
File Formats works
Please check the list of file formats that work in the below document. https://developers.facebook.com/docs/whatsapp/on-premises/reference/media
Note: Stickers - .webp ( Note:- Animated stickers are not allowed by WhatsApp).
WhatsApp supports stickers with a dimension of 512*512 px only. It needs to be exactly the same.
Store media files using GCS Integration
Go to your Google Cloud storage GCS account (https://console.cloud.google.com/apis/credentials/serviceaccountkey) to generate project API keys.
If you don't have an account in GCS please refer to Create an account in Google Cloud Storage (GCS) to set up a new account in Google Cloud storage GCS?.
Below screens may get change by Google. Refer below article from google for more details. https://cloud.google.com/iam/docs/creating-managing-service-account-keys
1 . At top Bar enter Service account. Select Service account
from the drop down.
2 . Click on +Create Service account
link from top bar.
3 . Enter the details.
a) Serive account name
b)Service account id auto filled.
c) Description.
4 . Click on Done
.
5 . Click on Add Key
button.
6 . Select json
and click on create
button.
Save the JSON in Glific to integrate
- Save the JSON file downloaded and copy its content.
- Login to your Glific account. Go to the
setting
option in Glific and click on Google Cloud Storage.
- Click on the
is_active
check.
-
Fill in the details from the downloaded JSON file.
- Paste the copied JSON content inside Goth Credentials input.
- Project Email as
client_email
in the JSON file. - "client_email": "xxx@xxx.iam.gserviceaccount.com",
- Bucket as the bucket name of the newly created bucket in the GCS dashboard
-
Click on
Save
button -
Once Credentials are set up, all media files will be synced in a bucket inside the uploads directory.
-
Now all the media files you will receive from the beneficiary contact (Via WhatsApp), will save in the Google cloud bucket in uploads folder.