Parameter whatsappServiceWebhookUrl added.
This commit is contained in:
parent
1bc4b37827
commit
3b6edd4f3a
4 changed files with 183 additions and 179 deletions
|
@ -99,6 +99,8 @@ export class GuaribasInstance extends Model<GuaribasInstance> implements IGBInst
|
|||
|
||||
@Column whatsappServiceUrl: string;
|
||||
|
||||
@Column whatsappServiceWebhookUrl: string;
|
||||
|
||||
@Column spellcheckerKey: string;
|
||||
|
||||
@Column theme: string;
|
||||
|
|
|
@ -104,6 +104,8 @@ export class GBConversationalService implements IGBConversationalService{
|
|||
} else if (intent === "ShowSubjectMenu") {
|
||||
session.replaceDialog("/menu");
|
||||
} else {
|
||||
// TODO testar diálogos v2
|
||||
// inclui diálogo
|
||||
session.sendTyping();
|
||||
session.send("Desculpe-me, não encontrei nada a respeito...");
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ export class GBWhatsappPackage implements IGBPackage {
|
|||
|
||||
loadBot(min: GBMinInstance): void {
|
||||
this.channel = new WhatsappDirectLine(min.botId, min.instance.whatsappBotKey, min.instance.whatsappServiceKey,
|
||||
min.instance.whatsappServiceNumber, min.instance.whatsappServiceUrl);
|
||||
min.instance.whatsappServiceNumber, min.instance.whatsappServiceUrl, min.instance.whatsappServiceWebhookUrl);
|
||||
}
|
||||
|
||||
unloadBot(min: GBMinInstance): void {
|
||||
|
|
|
@ -54,12 +54,13 @@ export class WhatsappDirectLine extends GBService {
|
|||
whatsappServiceKey: string;
|
||||
whatsappServiceNumber: string;
|
||||
whatsappServiceUrl: string;
|
||||
whatsappServiceWebhookUrl: string;
|
||||
botId: string;
|
||||
watermark: string = null;
|
||||
|
||||
conversationIds = {};
|
||||
|
||||
constructor(botId, directLineSecret, whatsappServiceKey, whatsappServiceNumber, whatsappServiceUrl) {
|
||||
constructor(botId, directLineSecret, whatsappServiceKey, whatsappServiceNumber, whatsappServiceUrl, whatsappServiceWebhookUrl) {
|
||||
|
||||
super();
|
||||
|
||||
|
@ -67,6 +68,7 @@ export class WhatsappDirectLine extends GBService {
|
|||
this.whatsappServiceKey = whatsappServiceKey;
|
||||
this.whatsappServiceNumber = whatsappServiceNumber;
|
||||
this.whatsappServiceUrl = whatsappServiceUrl;
|
||||
this.whatsappServiceWebhookUrl = whatsappServiceWebhookUrl;
|
||||
|
||||
// TODO: Migrate to Swagger 3.
|
||||
this.directLineClient = rp(this.directLineSpecUrl)
|
||||
|
@ -81,15 +83,13 @@ export class WhatsappDirectLine extends GBService {
|
|||
new Swagger.ApiKeyAuthorization('Authorization', 'Bearer ' +
|
||||
directLineSecret, 'header'));
|
||||
|
||||
|
||||
|
||||
var options = {
|
||||
method: 'POST',
|
||||
url: UrlJoin(this.whatsappServiceUrl, "webhook"),
|
||||
qs:
|
||||
{
|
||||
token: this.whatsappServiceKey,
|
||||
webhookUrl: `https://a2fc0900.ngrok.io/instances/${this.botId}/whatsapp`
|
||||
webhookUrl: `${this.whatsappServiceWebhookUrl}/instances/${this.botId}/whatsapp`
|
||||
},
|
||||
headers:
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue