Facebook messenger webhook did not receive any messages - facebook-graph-api

I am a beginner to use Facebook Graph API. I'm trying to set up a webhook to receive and send messages (or just only send messages). I have already verified it and succeeded. Then my webhook's also received messages from test webhooks. But when I use a real account to send messages or some acctions to my page. Nothing happened in my webhook.
Here's is my simple code in my webhook.
#csrf_exempt
def WebhookPAGEAPI(request):
event_json = json.loads(request.body)
print(event_json)
return HttpResponse('OK',status=200)
I tried enable live mode but still failed.

Related

How to create a bot that automatically responds to comments and sends messages to customers on your Facebook page

I want to develop a chatbot that can trigger when a user comments on a post on the page, then it will automatically reply and send a message to that user.
I'm referencing the following facebook documentation but it doesn't seem right
https://developers.facebook.com/docs/permissions/reference/pages_read_user_content

Notify Django Channels websocket from Rest Framework action

My app uses Django Rest Framework for the API. I wanted to add live notifications/status to it.
The flow would be
User loads page then makes a get API request to load data
Websocket connects on page load and subscribes to 'notifications' channel that's in ServerNotifConsumer
User clicks a button which sends a POST request to API that does some db stuff that would return success or failure info. Returns status 202 Accepted immediately then processes command.
Return info via websocket to all subscribed clients
Is there a way from within the DRF viewset action to send anything to the websocket consumer? Or would the best way to go about this be to rewrite the API endpoint to only receive via websocket? (rather not do)

Google Reports API Push notifications / Watch Requests not being received

A day ago I was able to use oauthplayground to successfully receive push notifications to my specified URL. Now when I send another watch request, I get a 200 ok as a response in the oauthplayground response box, but checking logs at the address (AWS API Gateway + Lambda Proxy) there is no POST message from google. No sync message or anything.
I tried to use google python client to send a watch request and same thing occurs.
body={'type':'web_hook','id':"id123",'address':'https://myaddress.com/notifications'}
response = service.activities().watch(userKey='all',applicationName='drive',body=body).execute()
I get similar response as in oauthplayground
{'kind': 'api#channel', 'id': 'some_id', 'resourceId': 'resource123', 'resourceUri': 'https://www.googleapis.com/admin/reports/v1/activity/users/all/applications/drive?alt=json', 'expiration': '1594846986000'}
I am able to send a POST message through Postman to my url and I see a log of that in CloudWatch. I have tried multiple times to send watch requests but although they are 200 status ok, I am still not receiving anything at my endpoint.
Could there possibly be a limitation on how many watch requests I am able to receive? Is there a reason Google accepts the request, but is not sending it to my URL?

Twilio - How to identify when user replies with opt-out keyword and unsubscribe them? - Django Python

I would like to unsubscribe a user from sms notifications when they reply with one of twilio's default opt-out keywords: STOP, UNSTOP, UNSUBSCRIBE or CANCEL https://support.twilio.com/hc/en-us/articles/223134027-Twilio-support-for-opt-out-keywords-SMS-STOP-filtering-
And resubscribe the client to my database & sms notifications if they type START, YES and UNSTOP
Is there a special way to do this? - I did not see any good doc from Twilio on how to handle this. Or do I just have to watch for the users to reply through my existing sms webhook and implement something such as the following:
def text_message(request):
if request.method == "POST":
message_body = request.POST['Body']
if message_body == "STOP" or message_body == "UNSTOP" or message_body == "UNSUBSCRIBE" or message_body == "CANCEL":
#unsubscribe phone number from my database
You are correct, your application needs to incorporate the logic to update the user channel preference in your CRM (so you don't attempt to send another SMS if that user opt-out of that channel). Twilio handles the blacklist for long codes, so if you attempt to send an opt-out party an SMS, Twilio will respond with an error.
Twilio support for opt-out keywords (SMS STOP filtering)
https://support.twilio.com/hc/en-us/articles/223134027-Twilio-support-for-opt-out-keywords-SMS-STOP-filtering-
Any of these STOP keyword replies will prevent a customer from
receiving new messages from the Twilio phone number they're responding
to. When Twilio receives one of these replies, we will create a
"blacklist" entry on our side, and then pass the message on to your
webhook. Once we have a blacklist entry for a particular recipient
phone number, any future attempts to message them will be met with a
400 response from our API, along with Error Code 21610 - Message
cannot be sent to the 'To' number because the customer has replied
with STOP. Recipients can disable this message stop, and resume
receiving messages with the START, YES, or UNSTOP commands as outlined
below.

WSO2 Identity password recovery

I am trying to send the password recovery notification using our own communication framework (The framework sends SMS and Android notification in addition to the email notification) by following the link Recover with Notification.
Notification.Sending.Internally.Managed=true
This enables the internal email sending module. If false, the email sending data is available to the application via a Web service. Thus the application can send the email using its own email sender.
Can any one please point me to the webservice that can be used to obtain the 'email sending data' as mentioned in the documentation.
i'm not aware of any webservice to receiving email sent from the notification module.
However, you can build a custom notification module and add in component/lib/ folder. see the below link for information and sample code
http://xacmlinfo.org/2015/09/07/custom-notification-module-for-account-management-in-wso2-identity-server-wso2is/