I have created a timeline card with a custom menu item. I would like to get a callback when the user has selected that menu item.
// Create a menu item for the card
var mnuActivate = new MenuItem() {
Action = "CUSTOM",
RemoveWhenSelected = new bool?(true),
Id = ACCEPT_ID,
Values = new List<MenuValue>() {
new MenuValue() {
State="DEFAULT",
DisplayName="Activate",
},
new MenuValue() {
State="PENDING",
DisplayName="Activating..."
},
new MenuValue() {
State="CONFIRMED",
DisplayName="Activated"
}
}
}
// Create a new card for the user's timeline
var item = new TimelineItem() {
Html = html,
Notification = new NotificationConfig() { Level = "DEFAULT" },
MenuItems = new List<MenuItem>() { mnuActivate }
};
var card = this._service.Timeline.Insert(item).Fetch();
I then subscribe to all timeline events and provide an https callback URL
// Create a new subscription
var subscription = new Subscription()
{
Collection = "timeline",
Operation = new List(),
CallbackUrl = "https://mypubliclyavailableserver.com/notify"
};
this._service.Subscriptions.Insert(subscription).Fetch();
// Retrieve a list of subscriptions to make sure it is there.
var mySubcriptions = this._service.Subscriptions.List().Fetch();
if (mySubcriptions != null && mySubcriptions.Items != null && mySubcriptions.Items.Count == 1)
{
Console.WriteLine("Subscription created successfully.");
}
So the subscription is created without any issues as far as I can tell. But after interacting with the card, I never get a callback. What am I missing?
Things I have tried:
- Populating Ids on the subscription obj, timeline card, and menuItem
- Subscribing before creating the card instead of after
- Adding the userId as the UserToken on the subscription object
- Calling my callback URL directly to ensure that it is listening
JSON Response from GET /mirror/v1/subscriptions:
{
"kind": "mirror#subscriptionsList",
"items": [
{
"kind": "mirror#subscription",
"id": "timeline",
"updated": "2013-10-28T15:19:19.404Z",
"collection": "timeline",
"callbackUrl": "https://mypubliclyavailableserver.com/notify"
}
]
}