Send a message with your application
Send a message through API
This guide will introduce you to send message with your application in Twake.
- You have already created a Twake application.
- Your application is installed and saved in your company.
- 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 !" }
- 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 }, }
- 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 !" }
- Send POST request with :
- Url: https://web.twake.app/api/messages/v1/companies/$COMPANYID/threads/$THREAD_ID
- Headers:
{ "Content-Type": "application/json",
Authorization: "Bearer " + $APP_TOKEN }
- Body:
{ resource: { $MESSAGE } }
The MessageObject 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.
Last modified 1yr ago