When I create a group and add a new member(the number of the newly added member is the number which is used to login to yowsup), I want to send a notification to all the members saying "Hello!". This reply should be automated. How do I do this?
I added a function in the file demos/cli/layer.py
def createGroupMessage(self, groupID,messageBody):
groupID = groupID + "@g.us"
outgoingMessageProtocolEntity = TextMessageProtocolEntity(
messageBody,
to = groupID
)
print outgoingMessageProtocolEntity
self.toLower(outgoingMessageProtocolEntity)
I am trying to call this in the file layers/ protocol_groups/protocolentities/notification_groups_create.py after doing the necessary imports:
def init(self, id, from, timestamp, notify, participant, offline,
createType, groupId, creationTimestamp, creatorJid,
subject, subjectTime, subjectOwnerJid,
participants):
super(CreateGroupsNotificationProtocolEntity, self).__init(_id, _from, timestamp, notify, participant, offline)
self.setGroupProps(createType, groupId, creationTimestamp, creatorJid, subject, subjectTime, subjectOwnerJid, participants)
self.foo1 = YowsupCliLayer()
self.foo1.createGroupMessage(groupId,"Hello !\n")
Although the code gives no error, I don't get any message when I add the yowsup number.
The output I get is:
Message:
ID: 1442859669-5
To: 919xxxxxx515-1442843444@g.us
Type: text
Timestamp: 1442859669
Body: Hello !!
Printing notification..
w:gp2
Notification: Notification
From: 919xxxxxx515-1442843444@g.us
Type: w:gp2
Participant: 919xxxxxx515@s.whatsapp.net
Creator: 919xxxxxx515@s.whatsapp.net
Create type: None
Creation timestamp: 1442843444
Subject: FBI
Subject owner: 919xxxxxx515@s.whatsapp.net
Subject timestamp: 1442843444
Participants: {'919xxxxxx515@s.whatsapp.net': 'admin', '91886xxxxx5@s.whatsapp.net': None}
Please let me know where am I going wrong or how can I solve this? Thanks!