Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add build YAML for Twilio functional test #3287

Merged

Conversation

santgr11
Copy link
Contributor

@santgr11 santgr11 commented Jan 22, 2020

Description

Adds a YAML file to set up a pipeline to run the functional test for Twilio.

This pull request depends on the test added in the PR #3286

Changes made

We added the file botbuilder-dotnet-ci-twilio-test.yml inside the build/yaml folder.

Before Setup

The following step by step guide uses a Trial Twilio account, which should last for approximately 200 text messages or runs of the test. If you want to use this functional test for an unlimited amount of time, you will need to upgrade your account to a paid version and add a balance to it.

Requirements

This test requires a valid phone number to receive text messages from the bot when it answers.
You can use a personal number, register a second Twilio account or buy a second number in a no trial account.

Variables Summary

This is a summary of the variables you will need to get before setting up the Azure pipeline

Name Source Description
AppId App Registration Portal The Application (client) ID of the App Registration.
AppSecret App Registration Portal The secret’s value from the table under Client secrets of the App Registration
SenderNumber Set up Twilio account Section The number where the bot will be sending the messages in format +123456423
TwilioAccountSid* Set up Twilio account Section The Twilio account Sid
TwilioAuthToken* Set up Twilio account Section The Twilio Auth token
TwilioNumber Set up Twilio account Section The Twilio number in format +123456423
AzureSubscription User The name of the Azure Resource Manager service connection configured in the pipeline
BotName User The name that will be used to deploy the bot to Azure
BotGroup User The resource group name used to deploy the bot to Azure

Setting Up

The next steps will guide you through the configuration of a Build pipeline based on the YAML files.

Prerequisites

  • Valid phone number, required to receive the messages from the bot.
  • Azure subscription, required to deploy the bot to Azure.
  • App Registration in Azure Portal, we need its AppId and AppSecret. More info here.
  • Azure DevOps organization.
  • Configured Service Connection in Azure DevOps (Steps below).
  • Set up a Twilio account (Steps below).

Set up Twilio account

  1. Go to Twilio's page to sign up for a free trial account.

    The signup process requires a valid phone number to receive text messages, this number will be the one we will be using to receive the messages as the SenderNumber.

    You can later check this number or verify a new one to use in the test in the Verified Caller IDs dashboard. Trial accounts can only send text messages to numbers verified there.

  2. Go to your Console Dashboard, click on Get Trial Number to register a new phone number with SMS capabilities, this will be your TwilioNumber, also take note of your account sid (TwilioAccountSid) and auth token (TwilioAuthToken).
    image

  3. Go to your Twilio's Active Numbers dashboard and click in your number.
    image

    Then, scroll down to the Messaging section.

    In the A message comes in field, select "Webhook" and fill it with the Bot Web App URL. https://<BotName>.azurewebsites.net/api/messages

    The URL may change depending on the value for the BotName variable you choose in the pipeline.

    image

Variables Outcome

Name Value
SenderNumber The valid phone number to receive text messages
TwilioNumber Trial Number in format +123456423
TwilioAccountSid Account SID
TwilioAuthToken Auth Token

Set up build pipeline

  1. Create a new build pipeline. Then, select the Use classic editor option.
    image

  2. Configure the repository and branch. Then, in the configuration as code, click on Apply for the YAML file option.
    image

  3. In section YAML, write the build name and select the build YAML file inside the folder build/yaml in the root of the directory.
    image

  4. In the Variables section add the following variables.
    *Set these variables as private.

    Name Source Description
    AppId* App Registration Portal The Application (client) ID of the App Registration.
    AppSecret* App Registration Portal The secret’s value from the table under Client secrets of the App Registration
    AzureSubscription User The name of the Azure Resource Manager service connection configured in the pipeline
    SenderNumber Set up Twilio account Section The number where the bot will be sending the messages in format +123456423
    TwilioAccountSid* Set up Twilio account Section The Twilio account Sid
    TwilioAuthToken* Set up Twilio account Section The Twilio Auth token
    TwilioNumber Set up Twilio account Section The Twilio number in format +123456423
    BotName User The name that will be used to deploy the bot to Azure
    BotGroup User The resource group name used to deploy the bot to Azure
  5. (Optional) Configure the triggers for the pipeline. By default, this pipeline runs every time a pull request is created or a commit is made in the master branch.

Create an Azure Resource Manager service connection

This step is required to use your Azure Subscription for the Windows and Linux CI builds. If you already have a Connection Service configured, save its Connection name to use it later as AzureSubscription.
For more info go to this link.

1- Navigate to Project settings -> Service Connections -> New service connection.
image

2- Select Azure Resource Manager and click Next. Then, select Service principal (manual)
image

3- In the New Azure Service Connection section, complete the next fields. Then, click on verify and save.

  • Subscription Id (stand for Azure Subscription Id)
  • Subscription Name
  • Services Principal Id
  • Service principal key
  • Tenant ID
  • Services connection name (Name used to refer to this service connection in the pipelines)
    image

Testing

In the image below you can see the run of a pipeline set up using this YAML file.
image

@coveralls
Copy link
Collaborator

coveralls commented Jan 22, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants