UNPKG

@mimamch/qontak

Version:
37 lines (36 loc) 1.96 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.getLogWhatsappMessageOutboundDirect = exports.sendWhatsappMessageOutboundDirect = void 0; const sendWhatsappMessageOutboundDirect = (options) => (props) => __awaiter(void 0, void 0, void 0, function* () { var _a; yield options.authenticate(); const response = yield options.axios.post("/api/open/v1/broadcasts/whatsapp/direct", { to_name: (_a = props.to_name) !== null && _a !== void 0 ? _a : props.to_number, to_number: props.to_number, message_template_id: props.message_template_id, channel_integration_id: props.channel_integration_id, language: props.language, parameters: props.parameters, name: props.name, }); return response.data.data; }); exports.sendWhatsappMessageOutboundDirect = sendWhatsappMessageOutboundDirect; /** * @param id direct message id */ const getLogWhatsappMessageOutboundDirect = (options) => (id) => __awaiter(void 0, void 0, void 0, function* () { yield options.authenticate(); const response = yield options.axios.get(`/api/open/v1/broadcasts/${id}/whatsapp/log`); return response.data; }); exports.getLogWhatsappMessageOutboundDirect = getLogWhatsappMessageOutboundDirect;