Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding endpoint to list waba_id and phone_number of a wpp-cloud integ… #612

Merged
merged 1 commit into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading