feat: init
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
---
|
||||
description: 'Welcome to the developers API of Twake, let''s begin together'
|
||||
---
|
||||
|
||||
# 🥇 Getting started
|
||||
|
||||
## Introduction:
|
||||
|
||||
_While users have the ability to create message complexes using the built-in formatting system, applications can go even further and offer many types of messages such as system messages for notifications or interactive messages for your most popular applications._
|
||||
|
||||
## Basics:
|
||||
|
||||
* [Create your first application](create-your-first-application.md)
|
||||
* [Authenticate with Postman](authenticate-postman.md)
|
||||
* [Send a message with your application](send-a-message-for-twake.md)
|
||||
* [Trigger action from command](trigger-action-from-command.md)
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
---
|
||||
description: Postman example
|
||||
---
|
||||
|
||||
# Authenticate with Postman
|
||||
|
||||
## Introduction:
|
||||
|
||||
This guide will introduce you to authenticate with [Postman](https://www.getpostman.com).
|
||||
|
||||
## Prerequisites:
|
||||
|
||||
* _You are a **manager** of the company._
|
||||
* You have already [created a Twake application](create-your-first-application.md).
|
||||
* _You have previously installed_ [_Postman_](https://www.getpostman.com)_._
|
||||
|
||||
## Steps:
|
||||
|
||||
### 1. Log your Application
|
||||
|
||||
* Open Postman 
|
||||
* Find the app's credentials according to [#3.-api-settings](create-your-first-application.md#3.-api-settings "mention")
|
||||
* Send POST request with : 
|
||||
* Url: https://web.twake.app/api/console/v1/login
|
||||
* Headers: `{ "Content-Type": "application/json", }`
|
||||
* Body: `{ id: $APP_`_`ID, secret: $APP_SECRET`_` ``}`
|
||||
* This POST request will return a JWT token, this token will allow your application to send events in Twake
|
||||
|
||||
### 2. Optional: Verify your token
|
||||
|
||||
If you're not sure that the procedure to generate a token goes well : 
|
||||
|
||||
* Send GET request with : 
|
||||
* Url: https://web.twake.app/api/console/v1/me
|
||||
* Headers: `{ "Content-Type": "application/json",` Authorization: "`Bearer " + $APP_TOKEN }`
|
||||
|
||||
|
||||
|
||||
###  
|
||||
@@ -0,0 +1,78 @@
|
||||
---
|
||||
description: >-
|
||||
You want to create an application for Twake? It's easy, just follow the steps
|
||||
in this documentation! 😀
|
||||
---
|
||||
|
||||
# Create your first application
|
||||
|
||||
## Introduction:
|
||||
|
||||
This guide will walk you through creating, setting up and installing a Twake application.
|
||||
|
||||
## Prerequisites:
|
||||
|
||||
- _You are a **manager** of the company._
|
||||
|
||||
## Steps:
|
||||
|
||||
### 1. Create a Twake application
|
||||
|
||||

|
||||
|
||||
1. _Start by opening your `Workspace settings`_
|
||||
2. _Go to `Applications and connectors`, you should see an **Installed applications area** and **Applications developed by the company**,_
|
||||
3. _Click on `Access your applications and connectors` then `Create an application`,_
|
||||
4. _Enter your application name and application group._ 
|
||||
|
||||
**Application group** is used to group your application with other applications of the same type. **Be careful, the application group will not be modifiable later.**
|
||||
|
||||
### **2. Identity of the application (Optional)**
|
||||
|
||||

|
||||
|
||||
Let's add a description and an icon for our application. \
|
||||
it will be much prettier! 😇
|
||||
|
||||
### 3. API settings
|
||||
|
||||
There you will find some important pieces of information:
|
||||
|
||||

|
||||
|
||||
- _Your API private key,_
|
||||
- _Your public application identifier,_
|
||||
- _URL that will be used to receive events for your application,_
|
||||
- _List of IP addresses that have the right to call the Twake API with your credentials. (You can use `*`during the development of your application.)_
|
||||
|
||||
**Private key** and **Public application identifier** relate to **calls to the Twake API**.
|
||||
|
||||
### 4. Display settings (Optional)
|
||||
|
||||

|
||||
|
||||
To configure where your application should display, you need to fill a `JSON` object in `Display Settings` field.
|
||||
|
||||
[Here](../application-settings/application-visibility-example.md) is a quick example, each field is optional and his presence determines the positioning of your application in Twake.
|
||||
|
||||
### 5. Application privileges
|
||||
|
||||

|
||||
|
||||
Your application can access and modify data, only according to your needs you don't need to access all the data present in Twake. \
|
||||
\
|
||||
This is why you must specify the accesses for the proper functioning of your application. These accesses will be public and indicated to the user before the installation of your application.
|
||||
|
||||
In our example, we will only add `message_save` and `message_remove` in `Write privileges`.\
|
||||
\
|
||||
If you want to know more about capabilities and privileges, take a look at the list [here](../application-settings/privileges.md).
|
||||
|
||||
### 6. Install application
|
||||
|
||||
Once you've configured your application, you need to install it on Twake. 
|
||||
|
||||

|
||||
|
||||
Go to `Applications and connectors`, search and display your application then install it.
|
||||
|
||||
Your application is now ready, check the [Authenticate with Postman](authenticate-postman.md) documentation for starting using it !
|
||||
@@ -0,0 +1,66 @@
|
||||
---
|
||||
description: Send a message through API
|
||||
---
|
||||
|
||||
# Send a message with your application
|
||||
|
||||
\
|
||||
Introduction: <a href="#introduction" id="introduction"></a>
|
||||
|
||||
---
|
||||
|
||||
This guide will introduce you to send message with your application in Twake.
|
||||
|
||||
## Prerequisites: <a href="#prerequisites" id="prerequisites"></a>
|
||||
|
||||
- You have already created a Twake application.
|
||||
- _Your application is installed and saved in your company._
|
||||
|
||||
## Steps: <a href="#steps" id="steps"></a>
|
||||
|
||||
### 1. Send message as a new Thread 
|
||||
|
||||
- Find the app's token according to [1. Log your Application](authenticate-postman.md#1.-log-your-application)
|
||||
- Find the identifiers to target a channel:
|
||||
- Company's _id: $COMPANY_ID_
|
||||
- Workspace's \_id: $WOKSPACE\_\_ID
|
||||
- Channel's _id: $CHANNEL_ID_
|
||||
- _Set the message you want to send:_
|
||||
|
||||
- _Minimal:_ 
|
||||
|
||||
_$MESSAGE = { "text": "Hello world !" }_
|
||||
|
||||
- _To take full advantage of the messages capability in Twake see the_ [_MessageObject_](../../internal-documentation/backend-services/messages/database-model.md)\_\_
|
||||
|
||||
- Send POST request with : 
|
||||
- Url: https://web.twake.app/api/messages/v1/companies/$COMPANY\_ID/threads
|
||||
- Headers: `{ "Content-Type": "application/json",` Authorization: "`Bearer " + $APP_TOKEN }`
|
||||
- Body: `{ resource: { participants: [ { type: "channel", id: $CHANNEL_ID, company_id: $COMPANY_ID, workspace_id: $WORKSPACE_ID, }, ], }, options: { $MESSAGE }, }`
|
||||
- This POST request will return a [ThreadObject](../../internal-documentation/backend-services/messages/database-model.md)
|
||||
|
||||
### 2. Send message as a Thread answer
|
||||
|
||||
- Find the app's token according to [1. Log your Application](authenticate-postman.md#1.-log-your-application)
|
||||
- Find the identifiers to target a channel:
|
||||
- Company's _id: $COMPANY_ID_
|
||||
- Workspace's \_id: $WOKSPACE\_\_ID
|
||||
- Channel's _id: $CHANNEL_ID_
|
||||
- _Thread's id: $THREAD_Id_
|
||||
- _Set the message you want to send:_
|
||||
|
||||
- _Minimal:_ 
|
||||
|
||||
_$MESSAGE = { "text": "Hello world !" }_
|
||||
|
||||
- _To take full advantage of the messages capability in Twake see the_ [_MessageObject_](../../internal-documentation/backend-services/messages/database-model.md)\_\_
|
||||
|
||||
- Send POST request with : 
|
||||
- Url: https://web.twake.app/api/messages/v1/companies/$COMPANY_ID/threads/$THREAD\__ID
|
||||
- Headers: `{ "Content-Type": "application/json",` Authorization: "`Bearer " + $APP_TOKEN }`
|
||||
- Body: `{ resource: { $MESSAGE } }`
|
||||
- This POST request will return a [MessageObject](../../internal-documentation/backend-services/messages/database-model.md)
|
||||
|
||||
### 3. Applications can send customized messages 
|
||||
|
||||
The [MessageObject](../../internal-documentation/backend-services/messages/database-model.md) object have a property called "block" that allow your application to send messages which contains more than a simple string. For example in an application message you can display an iFrame, buttons, menu selector, etc... Combining all this options you can create everything you want up to the limit of your imagination. To understand how to create powerful message using the block property see [blocks](../blocks.md).
|
||||
@@ -0,0 +1,41 @@
|
||||
---
|
||||
description: Trigger action from command
|
||||
---
|
||||
|
||||
# Trigger action from command
|
||||
|
||||
## Introduction: <a href="#introduction" id="introduction"></a>
|
||||
|
||||
This guide will introduce you to trigger action from your application using command
|
||||
|
||||
## Prerequisites: <a href="#prerequisites" id="prerequisites"></a>
|
||||
|
||||
* You have already created a Twake application.
|
||||
* Your application is installed and saved in your company.
|
||||
|
||||
## Steps: <a href="#steps" id="steps"></a>
|
||||
|
||||
### 1. Let your application listen to command
|
||||
|
||||
* Go in your app developer's setting: 
|
||||
* Click on your username in the top left corner
|
||||
* Go to workspace settings 
|
||||
* Go to integrations 
|
||||
* Click on the three-dot next to your application
|
||||
* Open developper setting 
|
||||
* Click on display 
|
||||
* You will find and editable object containing a twake object
|
||||
* Add a new property commands in this object like this:
|
||||
|
||||
* `"commands" : [{"command": string, "descritpion": string }]`
|
||||
* The first property of commands is command that let you define a name for your command, by default the command name is the name of your application. 
|
||||
* The second property of command is description that let you describe the way to use the command you want to define.
|
||||
|
||||
|
||||
|
||||
### 2. Use your command in a channel
|
||||
|
||||
* In the message editor write /command 
|
||||
* A popup displaying the description on how to use the command related to your application should open.
|
||||
|
||||
__
|
||||
Reference in New Issue
Block a user