Skip to content

Commit

Permalink
Merge pull request #204 from anupama-pathirage/fixOverviewIssues
Browse files Browse the repository at this point in the history
Fix issues in twilio API docs
  • Loading branch information
anupama-pathirage authored Sep 2, 2023
2 parents 461e369 + def9244 commit 6f283d5
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions ballerina/Module.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
## Overview

The Twilio API provides capability to access its platform for communications. These APIs connects the software layer and
communications networks around the world to allow users to call and message anyone, globally.
The Twilio API provides the capability to access its platform for communications. These APIs connect the software layer and
communications networks around the world to allow users to call and message anyone globally.

This module supports [Twilio Basic API version 2010-04-01](https://www.twilio.com/docs/all).
This package supports [Twilio Basic API version 2010-04-01](https://www.twilio.com/docs/all).

## Prerequisites
Before using this connector in your Ballerina application, complete the following:

* Create a [Twilio account](https://www.twilio.com/).
* Obtain tokens as follows:
Before using this connector in your Ballerina application, complete the following:

1. Create a Twilio account.
1. Create a [Twilio account](https://www.twilio.com/).

2. Obtain a [Twilio phone number](https://support.twilio.com/hc/en-us/articles/223136107-How-does-Twilio-s-Free-Trial-work-).

!!! Tip

If you use a trail account, you may need to verify your recipient phone numbers before having any communication with them.
>**Tip:** If you use a trial account, you may need to verify your recipient's phone numbers before having any communication with them.
3. Obtain a [Twilio Account Auth Token](https://support.twilio.com/hc/en-us/articles/223136027-Auth-Tokens-and-How-to-Change-Them).

Expand All @@ -27,38 +23,44 @@ If you use a trail account, you may need to verify your recipient phone numbers

# Quickstart

To use the Twilio connector in your Ballerina application, update the .bal file as follows:
To use the Twilio connector in your Ballerina application, update the `.bal` file as follows:

### Step 1 - Import connector
Import the Twilio module to your Ballerina program as follows. You can use [configurable variables](https://ballerina.io/learn/by-example/configurable.html) to provide the necessary credentials.
### Step 1 - Import the package

Import the Twilio package to your Ballerina program as follows. You can use [configurable variables](https://ballerina.io/learn/by-example/configurable.html) to provide the necessary credentials.

```ballerina
import ballerinax/twilio;
```

### Step 2 - Create a new connector instance

To create a new connector instance, add a configuration as follows:

```ballerina
configurable string accountSId = ?;
configurable string authToken = ?;
twilio:ConnectionConfig twilioConfig = {
auth: {
accountSId: accountSId,
authToken: authToken
accountSId,
authToken
}
};
twilio:Client twilioClient = new (twilioConfig);
twilio:Client twilio = new (twilioConfig);
```

### Step 3 - Invoke connector operation

1. Invoke the connector operation using the client as follows:

```ballerina
public function main() returns error? {
twilio:Account response = check twilioClient->getAccountDetails();
twilio:Account response = check twilio->getAccountDetails();
}
```

2. Use `bal run` command to compile and run the Ballerina program.

**[You can find more samples here](https://github.com/ballerina-platform/module-ballerinax-twilio/tree/master/twilio/samples)**

0 comments on commit 6f283d5

Please sign in to comment.