@tactfulai/channels
v3.0.2
Published
channel API SDK for Tactful.ai platform
Readme
Tactful.ai CHANNEL-SDK
How To use in your project
npm i @tactfulai/channels last version : 0.0.9
import { ChannelSDK , ChannelConfiguration } from "@tactfulai/channels";
const ChannelConfig = new ChannelConfiguration({
basePathEmail: "https://email.qa.dev.tactful.ai",
basePathMeta: "https://channels.qa.dev.tactful.ai",
basePathWebChat: "https://webchat.qa.dev.tactful.ai",
options: { mode: 'cors', }
})
const channelCore = new ChannelSDK(ChannelConfig)CHANNELS - CONTROLLER AND CRUD
FACEBOOK - CRUD
const facebookSettings = channelCore.metaChannel.facebookSettingsexample
const facebookSettings = await channelCore.metaChannel.facebookSettings.facebookSettingsGet({profile_id:25})WHATSAPP - CRUD
const whatsappSettings = channelCore.metaChannel.whatsAppSettings
const whatsappBuissnes = channelCore.metaChannel.whatsAppBusinessAccount
const whatsappMetaApp = channelCore.metaChannel.metaSettingsexample
const whatsappSettings = channelCore.metaChannel.whatsAppSettings.whatsAppSettingsGet({profile_id:25})WEBCHAT - CRUD
const webchatSettings = channelCore.webChatChannels.webchatSettingsexample
const webchatSettings = channelCore.webChatChannels.webchatSettings.webchatSettingsGet({profile_id:25})EMAIL - CRUD
const emailSettings = channelCore.emailChannels.emailSettingsexample
const emailSettings = channelCore.emailChannels.emailSettings.emailSettingsGet({profile_id:25})CONTROLLER
const metaController = channelCore.metaChannelApi.controller
const webchatController = channelCore.webchatChannelApi.controller
const emailController = channelCore.emailChannelApi.controllerexample
const sayFB = await channelCore.metaChannelApi.controller.say();
const sayWebchat = await channelCore.webchatChannelApi.controller.say();
const sayEmail = await channelCore.emailChannelApi.controller.say();GENERALIZE ENDPOINTS
Types
export declare type platforms = 'facebook'|'whatsapp'|'webchat'|'email';
export declare type platformCommand = 'connect' | 'disconnect';
export declare type messageCommand = 'say' | 'hide' | 'unhide' | 'delete';Actions
message
const messageAction = channelCore.messageAction('email',{},'say'); // {} => tactful message platform
const platformAction = channelCore.platformAction('webchat',{},'connect') // {} => connect payloadLIST ALL CHANNELS ENDPOINTS
listchannels.png
const allChannelsSettings = channelCore.listChannel(10) // 10 = profile id , this function return (meta setting + whatsapp settings + webchat settings + email settings)