Attention! Ngrok tunneling should not be used for production applications and was used here only for demonstration ease of use.
- Sign in to Developer Console.
- Go to the Apps section.
- Create a new app. You can use the Blank template and add the Authorization building block manually or use the Server-side webhook app template.
- Configure the Authorization building block.
- Choose server-side as the Client type.
- Add
$NGROK_PUBLIC_URL/oauth
to the Redirect URI whitelist. - Copy Client Id, Client Secret, and Redirect URI. You will need them when creating a configuration file for the app.
- Add
webhooks--all:rw
andchats--all:rw
to the list of requested scopes. - Use
$NGROK_PUBLIC_URL/oauth
as the Direct installation URL in the Marketplace authorization flow settings section.
Having troubles? Visit docs dedicated page for creating LiveChat apps.
-
Clone the repository
git clone https://github.com/livechat/lc-sdk-go/v6.git
-
In a terminal, navigate to
lc-sdk-go/examples/echo
cd lc-sdk-go/examples/echo
-
Create a config file from the example
cp config.example.json config.json # for Unix and Unix-like operating systems copy config.example.json config.json # for Windows
Use values saved when creating a LiveChat app to fill
config.json
. Assuming that$NGROK_PUBLIC_URL
is equal tohttps://3c6129e3.ngrok.io
, sample config file looks like:{ "client_id": "27f41c8da685c81a890f9e5f8ce48387", "client_secret": "78384ec8f5e9f098a18c586ad8c14f72", "redirect_uri": "https://3c6129e3.ngrok.io/oauth", "accounts_url": "https://accounts.livechatinc.com", "webhook_url": "https://3c6129e3.ngrok.io/webhook", "webhook_secret": "arbitrary_string" }
-
Start the app
go run .
- Sign in to Developer Console.
- Go to the Apps section.
- Select the app created in one of the previous sections.
- Move to the Private installation section and hit the install button.
Attention! For production applications, you want to publish the app.
Go to https://direct.lc.chat/$YOUR_LICENSE_ID
, start a chat, say hi and wait for Echo to respond.