This repository has been archived by the owner on Oct 30, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Andela Developer
authored and
Andela Developer
committed
Mar 6, 2018
1 parent
d37ac31
commit 4c83ff4
Showing
2 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# Stripe Payment Integration | ||
|
||
* Preparation: **2 minutes** | ||
* Requirements: | ||
* Initiated Syncano project | ||
* AWS ACCESS_KEY_ID | ||
* AWS SECRET_ACCESS_KEY | ||
* Region | ||
|
||
### Problem to solve | ||
|
||
You want to integrate a service that converts text to speech into application: | ||
|
||
### Solution | ||
|
||
Our solution is established using [aws-polly](https://syncano.io/#/sockets/aws-polly) Text-to-Speech (TTS) cloud service that converts text into lifelike speech. | ||
|
||
### Installing dependencies | ||
|
||
#### Server-side | ||
|
||
To install aws-polly, type: | ||
|
||
```sh | ||
$ syncano-cli add aws-polly | ||
``` | ||
|
||
Provide `AWS ACCESS_KEY_ID`, `AWS SECRET_ACCESS_KEY` and `Region` | ||
|
||
* N/B: To find `AWS ACCESS_KEY_ID` and `AWS SECRET_ACCESS_KEY`, log into your AWS account to get it. | ||
Also to get `Region`, search for Polly on your AWS Console to check supported regions and select one (e.g, us-east-1 ) | ||
|
||
Deploy aws-polly to update socket | ||
|
||
```sh | ||
$ syncano-cli deploy aws-polly | ||
``` | ||
|
||
#### Client-side | ||
|
||
Install syncano-client to interact with Syncano aws-polly socket: | ||
N/B: There are two way's of achieving installation. | ||
|
||
1. When using webpack and es6 the way to handle the client lib is: | ||
Shell: | ||
|
||
```sh | ||
$ npm i -S @syncano/client | ||
``` | ||
|
||
Create a connection by initializing Syncano object with instance name: | ||
|
||
```javascript | ||
import SyncanoClient from "@syncano/client" | ||
|
||
const s = new SyncanoClient("MY_INSTANCE_NAME"); | ||
``` | ||
|
||
2. And the vanilla js way: | ||
```HTML | ||
<script src="https://unpkg.com/@syncano/client"></script> | ||
<script> | ||
const s = new SyncanoClient("MY_INSTANCE_NAME"); | ||
</script> | ||
``` | ||
|
||
Implement text-to-speech process using aws-polly synthesizeSpeech endpoint: | ||
|
||
```javascript | ||
|
||
const polly = synthesizeSpeechParams => { | ||
try { | ||
const synthesizeSpeech = s.post("aws-polly/synthesizeSpeech", synthesizeSpeechParams); | ||
(response) => { | ||
return { data: response.data} | ||
} | ||
} catch (error) { | ||
return error.message; | ||
} | ||
}; | ||
``` | ||
|
||
### Testing functionality | ||
|
||
Now you can create a text-box collecting text from user and pass on to script file for conversion to speech. On you application, You could decide for your users to download file or listen to speech. |