Step 4: Setup Two-way Communication

To configure the setup for getting the incoming message in your Salesforce app :

1. Channel Configuration

  • Open the Channel Record for which you want to receive incoming messages.
  • Edit Channel record and check “Receive Incoming Message” checkbox and save it.

2. Scheduling an Apex Class

  • Go to Setup
  • Search for “Apex Classes” in quick find box and open it.
  • Click on “Schedule Apex” button.
  • Fill Job Name “IncomingMessageSchedulingJob” and Select Apex Class “PollingIncomingWhatsAppMessageScheduler” in Apex Class field.
  • Select Frequency as “Weekly” and select Today's day.
  • In “Start” choose today’s date.
  • Select upcoming preferred start time slot according to the time zone to schedule the apex class.
  • Click on “Save”.

📘

Note : -

The PollingIncomingWhatsAppMessageScheduler Schedular Class is scheduled every 5 minutes. Hence, you will receive incoming messages every 5 minutes (to reduce API Callouts).

To reduce/increase the interval of receiving incoming messages follow below steps : -

  • Go to Setup
  • In quick find box search for “Custom Labels” and open it.
  • Select view as “All” and click on “I” character.
  • Click on “Inbound_Polling_Scheduling_Time” and open it.
  • In Local Translations / Overrides section click on “New Local Translations / Overrides” button.
  • Select the Language.
  • Put the integer time interval you want to receive incoming messages every n minutes.
  • Click on Save
  • Now, you will receive incoming messages every n minutes.

📘

Note :

Decreasing Incoming message receiving interval will cause daily API Callout increase. So, please monitor the Governor limit of API Callouts in Company Information.