Skip to main content

Send the contact a message

3 minute 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.


Refer Flow level & Contact level variables to know more about how to use variables in flow.

image


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 . Clink on attachment tab.

image

4 . Choose upload attachment option from dropdown

image

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/api/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.

image

8 . Test the flow to verify the attachment sent with the message.

image

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

  1. Upload the file you want to send to the contact. Refer to the integration with the GCS article for detailed steps.

image

  1. Copy the public URL of the image uploaded.

image


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.

image

The value of expression will be a variable and the syntax used in is <%= "@results.fieldname" %>

image


Attach the media file in a message

  1. While editing a flow, select Send a message node.

  2. Click on the Attachments tab.

image

  1. 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

image

image

6 . Click ok to save.


Test the media message in the simulator

  1. 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.

image

Note:- Need to add some text in the send message node, otherwise the attachment will not be sent through flows

image


Size of image

Please use images of less than 5 MB. It is the maximum size limit currently.

Maximum size limit

  1. image file=> 5.120 MB
  2. Video file => 16.384 MB
  3. Audio file => 16.384 MB
  4. Document file => 102.400 MB
  5. Sticker file => 0.09 MB

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.

image


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.

image

2 . Click on +Create Service account link from top bar.

image

3 . Enter the details.

a) Serive account name

b)Service account id auto filled.

c) Description.

4 . Click on Done.

image

5 . Click on Add Key button.

image

6 . Select json and click on create button.

image


Save the JSON in Glific to integrate

  1. Save the JSON file downloaded and copy its content.
  2. Login to your Glific account. Go to the setting option in Glific and click on Google Cloud Storage.
  3. image

7 . Click on the is_active check.

image

8 . Fill in the details from the downloaded JSON file.

1. Paste the copied JSON content inside Goth Credentials input.
1. Project Email as `client_email` in the JSON file.
1. **_&quot;client_email&quot;: &quot;xxx@xxx.iam.gserviceaccount.com&quot;,_**
1. Bucket as the **bucket name** of the newly created bucket in the GCS dashboard

image

9 . Click on Save button

10 . Once Credentials are set up, all media files will be synced in a bucket inside the uploads directory.

11 . Now all the media files you will receive from the beneficiary contact (Via WhatsApp), will save in the Google cloud bucket in uploads folder.

image

image