Skip to content

Latest commit

 

History

History
56 lines (36 loc) · 3.42 KB

README.md

File metadata and controls

56 lines (36 loc) · 3.42 KB

CM.com Integration for SMS and WhatsApp Business

Feedback and Questions

As this integration is created and maintained by CM.com, the most direct way to find support is via their fork of the project. In that same project, you can open issues that will be read by the CM.com team of developers.

Updates and fixes in the CM.com fork will be propagated to the mail Dialogflow branch upon approval by the Dialogflow team.

If you are in need of more direct support, you can always reach out directly to CM.com via email or WhatsApp.

Setup

Prerequisites

  • Follow the instructions on the main README file in the root directory of this repository.
  • Register for a CM.com account and top-up.
  • Replace the value of projectId in the server.js file with your Dialogflow agent’s Project ID. (Click on the cog next to your project name and find the Google Project ID).

Getting a CM.com Channel

  • Log in to the CM.com Platform and go to the Channels page.
  • Acquire a channel by following the directions on screen.
  • Replace the value of cmProductToken in the server.js file with your CM.com Product Token. (in the bottom of your channel detail page.)
  • Make sure you do not commit this secret token to any public repository!

Currently both SMS and WhatsApp Business are supported. DialogFlow's response will be sent using the same channel as the original message was received on. As SenderID the receiving number will be used. Other channels might work, but are currently untested and unsupported.

Deploying the Integration Using Cloud Run

In your local terminal, change the active directory to the repository’s root directory.

Run the following command to save the state of your repository into GCP Container Registry. Replace PROJECT-ID with your agent’s GCP Project ID.

gcloud builds submit --tag gcr.io/PROJECT-ID/dialogflow-cm

Deploy your integration to live using the following command. Replace PROJECT-ID with your agent’s GCP project Id, and YOUR_KEY_FILE with the name (not path) of your Service Account JSON key file which you acquired in the Service Account Setup step of the main README file.

gcloud beta run deploy --image gcr.io/PROJECT-ID/dialogflow-cm --update-env-vars GOOGLE_APPLICATION_CREDENTIALS=YOUR_KEY_FILE --memory 1Gi
  • When prompted for a target platform, select a platform by entering the corresponding number (for example, 1 for Cloud Run (fully managed)).
  • When prompted for a region, select a region (for example, europe-west1).
  • When prompted for a service name hit enter to accept the default,
  • When prompted to allow unauthenticated invocations press y,
  • Copy the URL given to you at the end of the script.
  • Open the CM.com Channels page and set this as the webhook URL in the channel page and choose type JSON.

More information can be found in Cloud Run documentation.

You can view a list of your active integration deployments under Cloud Run in the GCP Console.