|
|
|
@ -21,6 +21,7 @@ func (controller *SendController) Route(app *fiber.App) { |
|
|
|
app.Post("/send/image", controller.SendImage) |
|
|
|
app.Post("/send/file", controller.SendFile) |
|
|
|
app.Post("/send/video", controller.SendVideo) |
|
|
|
app.Post("/send/contact", controller.SendContact) |
|
|
|
} |
|
|
|
|
|
|
|
func (controller *SendController) SendText(c *fiber.Ctx) error { |
|
|
|
@ -135,3 +136,27 @@ func (controller *SendController) SendVideo(c *fiber.Ctx) error { |
|
|
|
Results: response, |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
func (controller SendController) SendContact(c *fiber.Ctx) error { |
|
|
|
var request structs.SendContactRequest |
|
|
|
err := c.BodyParser(&request) |
|
|
|
utils.PanicIfNeeded(err) |
|
|
|
|
|
|
|
// add validation send contect
|
|
|
|
validations.ValidateSendContact(request) |
|
|
|
|
|
|
|
if request.Type == structs.TypeGroup { |
|
|
|
request.Phone = request.Phone + "@g.us" |
|
|
|
} else { |
|
|
|
request.Phone = request.Phone + "@s.whatsapp.net" |
|
|
|
} |
|
|
|
|
|
|
|
response, err := controller.Service.SendContact(c, request) |
|
|
|
utils.PanicIfNeeded(err) |
|
|
|
|
|
|
|
return c.JSON(utils.ResponseData{ |
|
|
|
Code: 200, |
|
|
|
Message: response.Status, |
|
|
|
Results: response, |
|
|
|
}) |
|
|
|
} |