You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pywa/api.py
+128Lines changed: 128 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -2856,3 +2856,131 @@ def delete_username(
2856
2856
method="DELETE",
2857
2857
endpoint=f"/{phone_id}/username",
2858
2858
)
2859
+
2860
+
defcreate_signup(
2861
+
self,
2862
+
waba_id: str,
2863
+
signup_message: str,
2864
+
confirmation_message: str,
2865
+
privacy_policy_url: str,
2866
+
website_url: str|None=None,
2867
+
promo_code: str|None=None,
2868
+
display_name: str|None=None,
2869
+
policy: dict[str, str|bool] |None=None,
2870
+
) ->dict:
2871
+
"""
2872
+
Create a signup deep link.
2873
+
2874
+
- Read more at `developers.facebook.com <https://developers.facebook.com/documentation/business-messaging/whatsapp/in-app-signup#create-signup>`_.
2875
+
2876
+
Args:
2877
+
waba_id: The ID of the WABA to create a signup for.
2878
+
signup_message: The description shown on the pre-consent screen when a WhatsApp user opens the deep link. Supports WhatsApp formatting. Must be 1-300 characters.
2879
+
confirmation_message: The message sent to the WhatsApp user immediately after a successful opt-in. Can contain the {{promo_code}} placeholder, which is replaced with the promo_code value in the delivered message. Must be 1-300 characters.
2880
+
privacy_policy_url: A link to your privacy policy. Must start with http:// or https://. Immutable after creation.
2881
+
website_url: Your business website URL. Must start with https://.
2882
+
promo_code: A promotional code value. Must contain only alphanumeric characters (letters and numbers) and be 1-50 characters. Replaces {{promo_code}} in the confirmation message.
2883
+
display_name: A business-facing nickname for the signup link. Not shown to WhatsApp users. Must be 1-256 characters.
2884
+
policy: The policy object with "tos" and "accepted" fields.
2885
+
2886
+
Returns:
2887
+
A dictionary containing the ID of the created signup.
2888
+
"""
2889
+
returnself._request(
2890
+
method="POST",
2891
+
endpoint=f"/{waba_id}/signups",
2892
+
json=self._filter_none(
2893
+
signup_message=signup_message,
2894
+
confirmation_message=confirmation_message,
2895
+
privacy_policy_url=privacy_policy_url,
2896
+
website_url=website_url,
2897
+
promo_code=promo_code,
2898
+
display_name=display_name,
2899
+
policy=policy,
2900
+
),
2901
+
)
2902
+
2903
+
defget_signups(
2904
+
self,
2905
+
waba_id: str,
2906
+
fields: tuple[str, ...] |None=None,
2907
+
pagination: dict[str, str] |None=None,
2908
+
) ->dict:
2909
+
"""
2910
+
List signup deep links for a WABA.
2911
+
2912
+
- Read more at `developers.facebook.com <https://developers.facebook.com/documentation/business-messaging/whatsapp/in-app-signup#list-signups>`_.
2913
+
2914
+
Args:
2915
+
waba_id: The ID of the WABA to list signups for.
2916
+
fields: Fields to retrieve.
2917
+
pagination: Pagination parameters.
2918
+
2919
+
Returns:
2920
+
A dictionary containing the list of signup deep links.
- Read more at `developers.facebook.com <https://developers.facebook.com/documentation/business-messaging/whatsapp/in-app-signup#get-signup-details>`_.
2936
+
2937
+
Args:
2938
+
signup_id: The ID of the signup deep link.
2939
+
2940
+
Returns:
2941
+
A dictionary containing the signup deep link.
2942
+
"""
2943
+
returnself._request(
2944
+
method="GET",
2945
+
endpoint=f"/signups/{signup_id}",
2946
+
)
2947
+
2948
+
defupdate_signup(
2949
+
self,
2950
+
signup_id: str,
2951
+
status: str|None=None,
2952
+
signup_message: str|None=None,
2953
+
confirmation_message: str|None=None,
2954
+
website_url: str|None=None,
2955
+
promo_code: str|None=None,
2956
+
display_name: str|None=None,
2957
+
) ->dict:
2958
+
"""
2959
+
Update a signup deep link.
2960
+
2961
+
- Read more at `developers.facebook.com <https://developers.facebook.com/documentation/business-messaging/whatsapp/in-app-signup#get-signup-details>`_.
2962
+
2963
+
Args:
2964
+
signup_id: The ID of the signup deep link.
2965
+
status: Updated status: ACTIVE or DISABLED.
2966
+
signup_message: The description shown on the pre-consent screen when a WhatsApp user opens the deep link. Supports WhatsApp formatting. Must be 1-300 characters.
2967
+
confirmation_message: The message sent to the WhatsApp user immediately after a successful opt-in. Can contain the {{promo_code}} placeholder, which is replaced with the promo_code value in the delivered message. Must be 1-300 characters.
2968
+
website_url: Your business website URL. Must start with https://.
2969
+
promo_code: A promotional code value. Must contain only alphanumeric characters (letters and numbers) and be 1-50 characters. Replaces {{promo_code}} in the confirmation message.
2970
+
display_name: A business-facing nickname for the signup link. Not shown to WhatsApp users. Must be 1-256 characters.
2971
+
2972
+
Returns:
2973
+
A dictionary containing the ID of the updated signup.
0 commit comments