Skip to content

Commit

Permalink
Merge pull request #612 from weni-ai/feature/get_wabas
Browse files Browse the repository at this point in the history
adding endpoint to list waba_id and phone_number of a wpp-cloud integ…
  • Loading branch information
BarbosaJackson authored Feb 13, 2025
2 parents 73abf16 + f806ee7 commit 703a1ed
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
16 changes: 16 additions & 0 deletions marketplace/core/types/channels/whatsapp_cloud/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,3 +223,19 @@ def report_sent_messages(self, request: "Request", **kwargs):
)

return Response(status=response.status_code)


class WhatsAppCloudInsights(views.APIView):
permission_classes = [ProjectManagePermission | IsCRMUser]

def get(self, request, *args, **kwargs):
project_uuid = request.query_params.get("project_uuid")
apps = App.objects.filter(project_uuid=project_uuid, code="wpp-cloud")
response = []
for app in apps:
response.append(
{
"waba_id": app.config.get("wa_waba_id", None),
"phone_number": app.config.get("phone_number")
}
)
7 changes: 7 additions & 0 deletions marketplace/core/types/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from rest_framework_nested import routers

from marketplace.core import types
from marketplace.core.types.channels.whatsapp_cloud.views import WhatsAppCloudInsights


urlpatterns = []
Expand All @@ -25,8 +26,14 @@
"apptypes/wpp-cloud/",
include("marketplace.core.types.channels.whatsapp_cloud.catalogs.urls"),
),
path(
"apptypes/wpp-cloud/list_wpp-cloud/<uuid:project_uuid>/",
WhatsAppCloudInsights.as_view(),
name="wpp-cloud-insights"
)
)


# VTEX
urlpatterns.append(
path("apptypes/vtex/", include("marketplace.core.types.ecommerce.vtex.urls")),
Expand Down

0 comments on commit 703a1ed

Please sign in to comment.