Skip to content

Latest commit

 

History

History

viber

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Viber Integration for Dialogflow CX

Setup

Prerequisites

  • Follow the instructions on the main README file in the root directory of this repository.
  • Download the Viber app on your mobile device and set up account on that device.
  • Set up a bot account.
  • Create and add your GCP service account key to the current folder.
  • Uncomment and fill in the variables on the top of the server.js file

Obtaining Viber Credentials

  • Log in to your bot account.
  • On the main screen, take the values for Token, the URL for your bot’s avatar, and Account Name and replace the values for viberToken, botAvatarLink, and botName in the server.js file respectively.

alt text

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-viber

Deploy your integration to Cloud Run using the following command. Replace PROJECT_ID with your agent’s GCP project Id, and DIALOGFLOW_SERIVCE_ACCOUNT with the Service Account which you acquired in the Service Account Setup step of the main README file.

gcloud beta run deploy --image gcr.io/PROJECT_ID/dialogflow-viber --service-account DIALOGFLOW_SERVICE_ACCOUNT --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, us-central1).
  • 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, and use it according to the README file in the given integration's folder.

Take the value for the server URL printed in the console after the completion of the execution of the above command and replace the value for webhookUrl in the server.js file.

Redeploy the integration with the updated change by rerunning the above two commands.

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.

Testing the Integration

In order to test VIBER_WELCOME message follow these steps

  • On the start page of your agent add an event handler
  • Click "Use custom event" and add the event name (VIBER_WELCOME)
  • Under fulfillment edit the agent's response
  • To test the welcome message simply start a converstion with the bot

In order to test rich response messages follow these steps

  • To add rich response navigate to the fulfillment editing panel of the agent
  • Click "Add dialogue option" and select custom payload
  • Then add the corresponding parameters for the specific message type according to Viber's layout
    • For example, to send a picture message add these required parameters